@@ -136,17 +136,102 @@ jobs:
136136# path: dist-pkg/${{ matrix.pkg_name }}.tar.gz
137137# if-no-files-found: error
138138
139- bundle-and-release :
139+ bundle-linux :
140+ needs : [get-configs, version-and-tag]
141+ permissions :
142+ contents : write
143+
144+ strategy :
145+ matrix :
146+ include :
147+ - { os: "ubuntu-latest", arch: "x64", container: "amazonlinux:2", platform: "linux", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false }
148+ - { os: "ubuntu-latest", arch: "arm64", container: "amazonlinux:2", platform: "linux", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true }
149+ runs-on : ${{ matrix.os }}
150+ steps :
151+ - uses : actions/checkout@v5
152+ with :
153+ ref : ${{ needs.version-and-tag.outputs.tag }}
154+ fetch-tags : true
155+
156+ - name : Git Status
157+ shell : bash
158+ run : echo "Bundling from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
159+
160+ - name : Set release asset name
161+ id : set-asset-name
162+ shell : bash
163+ run : |
164+ APP_NAME=${{ needs.get-configs.outputs.app-name }}
165+ VERSION=$(node -p "require('./package.json').version")
166+ PLATFORM=${{ matrix.platform }}
167+ ARCH=${{ matrix.arch }}
168+
169+ TAG=${{ needs.version-and-tag.outputs.tag }}
170+ if [[ "$TAG" =~ -alpha$ ]]; then
171+ FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}.zip"
172+ elif [[ "$TAG" =~ -beta$ ]]; then
173+ FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}.zip"
174+ else
175+ FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}.zip"
176+ fi
177+
178+ ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
179+ echo "ASSET_NAME=${ASSET_NAME}"
180+ echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
181+
182+ - name : Set up QEMU for ARM emulation
183+ if : matrix.use_qemu
184+ uses : docker/setup-qemu-action@v3
185+
186+ - name : Build in Container
187+ env :
188+ ASSET_NAME : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
189+ run : |
190+ docker run --rm -v ${{ github.workspace }}:/work -w /work \
191+ --platform ${{ matrix.docker-platform }} \
192+ ${{ matrix.container }} \
193+ /bin/bash -c "
194+
195+ yum install -y curl make gcc-c++ python3 tar gzip
196+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
197+ export NVM_DIR=\"\$HOME/.nvm\"
198+ [ -s \"\$NVM_DIR/nvm.sh\" ] && \. \"\$NVM_DIR/nvm.sh\"
199+ nvm install ${{ needs.get-configs.outputs.node-version }}
200+ npm install -g npm@latest
201+
202+ npm ci
203+
204+ TAG=${{ needs.version-and-tag.outputs.tag }}
205+ if [[ "$TAG" =~ -alpha$ ]]; then
206+ npm run bundle:alpha
207+ elif [[ "$TAG" =~ -beta$ ]]; then
208+ npm run bundle:beta
209+ else
210+ npm run bundle:prod
211+ fi
212+
213+ GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
214+ cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
215+
216+ echo "Creating zip: ${ASSET_NAME}"
217+ (cd ./bundle/production && zip -r ../../${{ env.ASSET_NAME }} .)
218+ "
219+
220+ - name : Upload artifact
221+ uses : actions/upload-artifact@v4
222+ with :
223+ name : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
224+ path : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
225+ if-no-files-found : error
226+
227+ bundle-win-mac :
140228 needs : [get-configs, version-and-tag]
141229 permissions :
142230 contents : write
143231 strategy :
144232 fail-fast : true
145233 matrix :
146234 include :
147- - { os: "ubuntu-latest", arch: "x64", platform: "linux", go-arch: "amd64" }
148- - { os: "ubuntu-latest", arch: "arm64", platform: "linux", go-arch: "arm64" }
149- - { os: "ubuntu-latest", arch: "arm", platform: "linux", go-arch: "arm" }
150235 - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64" }
151236 - { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64" }
152237 - { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64" }
@@ -239,13 +324,31 @@ jobs:
239324 echo "Creating zip: ${{ env.ASSET_NAME }}"
240325 Compress-Archive -Path ./bundle/production/* -DestinationPath ./${{ env.ASSET_NAME }}
241326
327+ - name : Upload artifact
328+ uses : actions/upload-artifact@v4
329+ with :
330+ name : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
331+ path : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
332+ if-no-files-found : error
333+
334+ release :
335+ needs : [ bundle-win-mac, bundle-linux ]
336+ permissions :
337+ contents : write
338+
339+ steps :
340+ - uses : actions/download-artifact@v5
341+ with :
342+ path : artifacts/
343+
344+ - name : List artifacts
345+ run : ls -R artifacts/
346+
242347 - name : Create GitHub Release
243348 uses : softprops/action-gh-release@v2
244- env :
245- ASSET_NAME : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
246349 with :
247350 tag_name : ${{ needs.version-and-tag.outputs.tag }}
248351 prerelease : ${{ needs.version-and-tag.outputs.is-prerelease }}
249- files : ${{ env.ASSET_NAME }}
352+ files : artifacts/*
250353 generate_release_notes : true
251354 fail_on_unmatched_files : true
0 commit comments