11
11
type : string
12
12
default : " stable"
13
13
required : true
14
+ set_latest :
15
+ description : ' Tag as latest'
16
+ type : boolean
17
+ default : false
14
18
env :
15
19
IMAGE_NAME : godot-ci
16
20
jobs :
@@ -33,13 +37,58 @@ jobs:
33
37
else
34
38
echo "dotnet_version=mcr.microsoft.com/dotnet/sdk:8.0-jammy" >> $GITHUB_OUTPUT
35
39
fi
36
-
40
+ get_tags :
41
+ name : Get Tags
42
+ runs-on : ubuntu-22.04
43
+ outputs :
44
+ tags : ${{steps.write_tags.outputs.tags}}
45
+ tags_mono : ${{steps.write_tags_mono.outputs.tags}}
46
+ steps :
47
+ - run : echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
48
+ - run : echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
49
+ - name : Set tags
50
+ run : |
51
+ echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags.txt
52
+ echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags.txt
53
+ - name : Set latest tags
54
+ if : ${{inputs.set_latest}}
55
+ run : |
56
+ echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest" >> tags.txt
57
+ echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest" >> tags.txt
58
+ - name : Set Mono tags
59
+ run : |
60
+ echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags_mono.txt
61
+ echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags_mono.txt
62
+ - name : Set Mono latest tags
63
+ if : ${{inputs.set_latest}}
64
+ run : |
65
+ echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-latest" >> tags_mono.txt
66
+ echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-latest" >> tags_mono.txt
67
+ - uses : actions/upload-artifact@v4
68
+ with :
69
+ name : image_tags
70
+ path : tags.txt
71
+ retention-days : 1
72
+ - uses : actions/upload-artifact@v4
73
+ with :
74
+ name : image_tags_mono
75
+ path : tags_mono.txt
76
+ retention-days : 1
37
77
build :
38
78
name : Build Image
39
79
runs-on : ubuntu-22.04
80
+ needs : get_tags
40
81
steps :
82
+ - uses : actions/download-artifact@v4
83
+ with :
84
+ name : image_tags
85
+ - run : |
86
+ {
87
+ echo 'TAGS<<EOF'
88
+ cat tags.txt
89
+ echo EOF
90
+ } >> "$GITHUB_ENV"
41
91
- uses : actions/checkout@v3
42
- - run : echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
43
92
- name : Login to GitHub Container Registry
44
93
45
94
with :
@@ -51,16 +100,13 @@ jobs:
51
100
with :
52
101
username : ${{ secrets.DOCKERHUB_USERNAME }}
53
102
password : ${{ secrets.DOCKERHUB_TOKEN }}
54
- - run : echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
55
103
- name : Build and push Docker images
56
104
57
105
with :
58
106
context : .
59
107
file : Dockerfile
60
108
push : true
61
- tags : |
62
- ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
63
- ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
109
+ tags : ${{ env.TAGS }}
64
110
build-args : |
65
111
GODOT_VERSION=${{ github.event.inputs.version }}
66
112
RELEASE_NAME=${{ github.event.inputs.release_name }}
@@ -70,10 +116,18 @@ jobs:
70
116
build-mono :
71
117
name : Build Mono Image
72
118
runs-on : ubuntu-22.04
73
- needs : [version]
119
+ needs : [version, get_tags ]
74
120
steps :
121
+ - uses : actions/download-artifact@v4
122
+ with :
123
+ name : image_tags_mono
124
+ - run : |
125
+ {
126
+ echo 'TAGS<<EOF'
127
+ cat tags_mono.txt
128
+ echo EOF
129
+ } >> "$GITHUB_ENV"
75
130
- uses : actions/checkout@v3
76
- - run : echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
77
131
- name : Login to GitHub Container Registry
78
132
79
133
with :
@@ -85,16 +139,13 @@ jobs:
85
139
with :
86
140
username : ${{ secrets.DOCKERHUB_USERNAME }}
87
141
password : ${{ secrets.DOCKERHUB_TOKEN }}
88
- - run : echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
89
142
- name : Build and push Docker images
90
143
91
144
with :
92
145
context : .
93
146
file : mono.Dockerfile
94
147
push : true
95
- tags : |
96
- ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
97
- ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}
148
+ tags : ${{ env.TAGS }}
98
149
build-args : |
99
150
IMAGE=${{ needs.version.outputs.dotnet_version }}
100
151
GODOT_VERSION=${{ github.event.inputs.version }}
0 commit comments