@@ -106,10 +106,6 @@ jobs:
106106 - name : Checkout
107107 uses : actions/checkout@v3
108108
109- - name : Get the version
110- id : get_version
111- run : echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
112-
113109 - name : Set up Go
114110 uses : actions/setup-go@v3
115111 with :
@@ -131,10 +127,12 @@ jobs:
131127 export _NAME=nginx-ui-$(jq ".$GOOS[\"$GOARCH$GOARM\"].name" -r < .github/build/build_info.json)
132128 export _ARCH=$(jq ".$GOOS[\"$GOARCH$GOARM\"].arch" -r < .github/build/build_info.json)
133129 export _ABI=$(jq ".$GOOS[\"$GOARCH$GOARM\"].abi // \"\"" -r < .github/build/build_info.json)
134- echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, ABI: $_ABI, RELEASE_NAME: $_NAME"
130+ export _ARTIFACT=nginx-ui-$GOOS-$GOARCH$(if [[ "$GOARM" ]]; then echo "v$GOARM"; fi)
131+ echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, ABI: $_ABI, RELEASE_NAME: $_NAME, ARTIFACT_NAME: $_ARTIFACT"
135132 echo "ARCH_NAME=$_ARCH" >> $GITHUB_ENV
136133 echo "ABI=$_ABI" >> $GITHUB_ENV
137134 echo "DIST=$_NAME" >> $GITHUB_ENV
135+ echo "ARTIFACT=$_ARTIFACT" >> $GITHUB_ENV
138136
139137 - name : Install musl cross compiler
140138 if : env.GOOS == 'linux'
@@ -176,7 +174,7 @@ jobs:
176174 - name : Archive backend artifacts
177175 uses : actions/upload-artifact@v3
178176 with :
179- name : ${{ env.DIST }}
177+ name : ${{ env.ARTIFACT }}
180178 path : dist/nginx-ui
181179
182180 - name : Prepare publish
@@ -191,49 +189,66 @@ jobs:
191189 with :
192190 files : ${{ env.DIST }}.tar.gz
193191
192+ docker-build :
193+ runs-on : ubuntu-latest
194+ needs : build
195+ env :
196+ PLATFORMS : linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5
197+ steps :
198+ - name : Checkout
199+ uses : actions/checkout@v3
200+
201+ - name : Get the version
202+ id : get_version
203+ run : echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
204+
205+ - name : Download artifacts
206+ uses : actions/download-artifact@v3
207+ with :
208+ path : ./dist
209+
210+ - name : Prepare Artifacts
211+ run : chmod +x ./dist/nginx-ui-*/nginx-ui
212+
194213 - name : Set up Docker Buildx
195- if : env.GOOS == 'linux' && env.GOARCH == 'amd64'
196214 id : buildx
197215 uses : docker/setup-buildx-action@v2
198216
199217 - name : Login to DockerHub
200- if : env.GOOS == 'linux' && env.GOARCH == 'amd64'
201218 uses : docker/login-action@v2
202219 with :
203220 username : ${{ secrets.DOCKERHUB_USER }}
204221 password : ${{ secrets.DOCKERHUB_TOKEN }}
205222
206223 - name : Prepare Dockerfile
207- if : github.event_name == 'release' && env.GOOS == 'linux' && env.GOARCH == 'amd64'
224+ if : github.event_name == 'release'
208225 run : |
209226 cp ./Dockerfile ./dist
210227 cp -rp ./resources ./dist
211228
212229 - name : Build and push
213- if : github.event_name == 'release' && env.GOOS == 'linux' && env.GOARCH == 'amd64'
230+ if : github.event_name == 'release'
214231 uses : docker/build-push-action@v3
215232 with :
216233 context : ./dist
217234 file : ./dist/Dockerfile
218- platforms : linux/amd64
235+ platforms : ${{ env.PLATFORMS }}
219236 push : ${{ github.event_name != 'pull_request' }}
220237 tags : |
221238 uozi/nginx-ui:latest
222239 uozi/nginx-ui:${{ steps.get_version.outputs.VERSION }}
223240
224241 - name : Prepare Demo Dockerfile
225- if : env.GOOS == 'linux' && env.GOARCH == 'amd64'
226242 run : |
227243 cp ./demo.Dockerfile ./dist
228244 cp -rp ./resources ./dist
229245
230246 - name : Build and push demo
231- if : env.GOOS == 'linux' && env.GOARCH == 'amd64'
232247 uses : docker/build-push-action@v3
233248 with :
234249 context : ./dist
235250 file : ./dist/demo.Dockerfile
236- platforms : linux/amd64
251+ platforms : ${{ env.PLATFORMS }}
237252 push : ${{ github.event_name != 'pull_request' }}
238253 tags : |
239254 uozi/nginx-ui-demo:latest
0 commit comments