@@ -58,41 +58,113 @@ jobs:
5858 exit 1
5959 fi
6060
61- build-and-test :
62- needs : [ get-configs, version-and-tag ]
63- uses : ./.github/workflows/build-and-test.yml
61+ build-and-test :
62+ needs : [ get-configs, version-and-tag ]
63+ uses : ./.github/workflows/build-and-test.yml
64+ strategy :
65+ fail-fast : true
66+ matrix :
67+ os : [ ubuntu-22.04, windows-latest, macos-latest ]
68+ with :
69+ ref : ${{ needs.version-and-tag.outputs.tag }}
70+ runs-on : ${{ matrix.os }}
71+
72+ bundle-linux :
73+ needs : [ get-configs, version-and-tag, build-and-test ]
6474 strategy :
6575 fail-fast : true
6676 matrix :
67- os : [ ubuntu-22.04, windows-latest, macos-latest ]
68- with :
69- ref : ${{ needs.version-and-tag.outputs.tag }}
70- runs-on : ${{ matrix.os }}
77+ include :
78+ - { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
79+ - { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
80+ runs-on : ubuntu-22.04
81+ steps :
82+ - uses : actions/checkout@v5
83+ with :
84+ ref : ${{ needs.version-and-tag.outputs.tag }}
85+ fetch-tags : true
86+
87+ - name : Set release asset name
88+ id : set-asset-name
89+ shell : bash
90+ run : |
91+ APP_NAME=${{ needs.get-configs.outputs.app-name }}
92+ VERSION=$(node -p "require('./package.json').version")
93+ NODE_VERSION=${{ matrix.node-version }}
94+ NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)
95+
96+ TAG=${{ needs.version-and-tag.outputs.tag }}
97+ if [[ "$TAG" =~ -alpha$ ]]; then
98+ FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
99+ elif [[ "$TAG" =~ -beta$ ]]; then
100+ FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
101+ else
102+ FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
103+ fi
104+
105+ ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
106+ echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
107+
108+ - name : Set up QEMU
109+ if : matrix.use_qemu
110+ uses : docker/setup-qemu-action@v3
111+
112+ - name : Bundle (${{ matrix.docker-platform }}
113+ run : |
114+ docker run --rm -v ${{ github.workspace }}:/work -w /work \
115+ --platform ${{ matrix.docker-platform }} \
116+ amazonlinux:2023 \
117+ /bin/bash -c '
118+ set -ex
119+ yum install -y make gcc-c++ python3 tar gzip wget tree
120+
121+ wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
122+ tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
123+ export PATH=$PATH:/usr/local/go/bin
124+
125+ curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
126+ export NVM_DIR="$HOME/.nvm"
127+ . "$NVM_DIR/nvm.sh"
128+ nvm install ${{ matrix.node-version }}
129+ nvm use ${{ matrix.node-version }}
130+
131+ npm ci
71132
72- bundle :
133+ TAG="${{ needs.version-and-tag.outputs.tag }}"
134+ if [[ "$TAG" =~ -alpha$ ]]; then
135+ npm run bundle:alpha
136+ elif [[ "$TAG" =~ -beta$ ]]; then
137+ npm run bundle:beta
138+ else
139+ npm run bundle:prod
140+ fi
141+
142+ tree -f bundle/production/node_modules/tree-sitter
143+ tree -f bundle/production/node_modules/tree-sitter-json
144+
145+ GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
146+ cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
147+ '
148+
149+ - name : Upload artifact
150+ uses : actions/upload-artifact@v4
151+ with :
152+ name : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
153+ path : bundle/production/
154+ if-no-files-found : error
155+ include-hidden-files : true
156+ compression-level : 6
157+
158+ bundle-win-mac :
73159 needs : [ get-configs, version-and-tag, build-and-test ]
74160 strategy :
75161 fail-fast : true
76162 matrix :
77163 include :
78- - { os: "ubuntu-22.04", arch: "x64", platform: "linux", go-arch: "amd64", node-version: "18.x" }
79- - { os: "ubuntu-22.04", arch: "x64", platform: "linux", go-arch: "amd64", node-version: "20.x" }
80- - { os: "ubuntu-22.04", arch: "x64", platform: "linux", go-arch: "amd64", node-version: "22.x" }
81- - { os: "ubuntu-22.04", arch: "arm64", platform: "linux", go-arch: "arm64", node-version: "18.x" }
82- - { os: "ubuntu-22.04", arch: "arm64", platform: "linux", go-arch: "arm64", node-version: "20.x" }
83- - { os: "ubuntu-22.04", arch: "arm64", platform: "linux", go-arch: "arm64", node-version: "22.x" }
84- - { os: "ubuntu-22.04", arch: "arm", platform: "linux", go-arch: "arm", node-version: "18.x" }
85- - { os: "ubuntu-22.04", arch: "arm", platform: "linux", go-arch: "arm", node-version: "20.x" }
86- - { os: "ubuntu-22.04", arch: "arm", platform: "linux", go-arch: "arm", node-version: "22.x" }
87- - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "18.x" }
88- - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "20.x" }
89164 - { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
90- - { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "18.x" }
91- - { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "20.x" }
92165 - { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
93- - { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "18.x" }
94- - { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "20.x" }
95166 - { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "22.x" }
167+ - { os: "windows-11-arm", arch: "arm64", platform: "win32", go-arch: "arm64", node-version: "22.x" }
96168 runs-on : ${{ matrix.os }}
97169 steps :
98170 - uses : actions/checkout@v5
@@ -124,11 +196,11 @@ jobs:
124196 run : |
125197 TAG=${{ needs.version-and-tag.outputs.tag }}
126198 if [[ "$TAG" =~ -alpha$ ]]; then
127- npm run bundle:alpha -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
199+ npm run bundle:alpha
128200 elif [[ "$TAG" =~ -beta$ ]]; then
129- npm run bundle:beta -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
201+ npm run bundle:beta
130202 else
131- npm run bundle:prod -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
203+ npm run bundle:prod
132204 fi
133205
134206 - name : Bundle Go
@@ -156,58 +228,56 @@ jobs:
156228
157229 TAG=${{ needs.version-and-tag.outputs.tag }}
158230 if [[ "$TAG" =~ -alpha$ ]]; then
159- FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}-node${NODE_MAJOR}.zip "
231+ FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
160232 elif [[ "$TAG" =~ -beta$ ]]; then
161- FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}-node${NODE_MAJOR}.zip "
233+ FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
162234 else
163- FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}-node${NODE_MAJOR}.zip "
235+ FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
164236 fi
165237
166238 ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
167239 echo "ASSET_NAME=${ASSET_NAME}"
168240 echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
169241
170- - name : Create Zip (Unix)
171- if : runner.os != 'Windows'
172- env :
173- ASSET_NAME : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
174- run : |
175- chmod -R 777 ./bundle/production
176- echo "Creating zip: ${{ env.ASSET_NAME }}"
177- (cd ./bundle/production && zip -r ../../${{ env.ASSET_NAME }} .)
178-
179- - name : Create Zip (Windows)
180- if : runner.os == 'Windows'
181- env :
182- ASSET_NAME : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
183- run : |
184- icacls ./bundle/production /grant Everyone:F /T
185- echo "Creating zip: ${{ env.ASSET_NAME }}"
186- Compress-Archive -Path ./bundle/production/* -DestinationPath ./${{ env.ASSET_NAME }}
187-
188242 - name : Upload artifact
189243 uses : actions/upload-artifact@v4
190244 with :
191245 name : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
192- path : ${{ steps.set-asset-name.outputs.ASSET_NAME }}
246+ path : bundle/production/
193247 if-no-files-found : error
248+ include-hidden-files : true
249+ compression-level : 6
194250
195251 release :
196- needs : [ version-and-tag, bundle ]
252+ needs : [ version-and-tag, bundle-linux, bundle-win-mac ]
197253 runs-on : ubuntu-latest
198254 permissions :
199255 contents : write
200256 steps :
201257 - name : Download all artifacts
202- uses : actions/download-artifact@v4
258+ uses : actions/download-artifact@v5
203259 with :
204260 path : artifacts
261+ extract : false
262+
263+ - name : Create zip files for release
264+ run : |
265+ ls -R artifacts/
266+
267+ cd artifacts
268+ for dir in */; do
269+ dirname="${dir%/}"
270+ echo "Creating ${dirname}.zip"
271+ (cd "$dirname" && zip -r "../${dirname}.zip" .)
272+ rm -rf "$dirname"
273+ done
274+ ls -lh *.zip
205275
206276 - name : Create GitHub Release
207277 uses : softprops/action-gh-release@v2
208278 with :
209279 tag_name : ${{ needs.version-and-tag.outputs.tag }}
210280 prerelease : ${{ needs.version-and-tag.outputs.is-prerelease }}
211- files : artifacts/**/*
281+ files : artifacts/*.zip
212282 generate_release_notes : true
213283 fail_on_unmatched_files : true
0 commit comments