Skip to content

Commit 1b9d890

Browse files
authored
Merge branch 'main' into constants
2 parents 925973a + 2bc8c04 commit 1b9d890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7581
-3994
lines changed

.github/workflows/alpha-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
with:
2222
ref: ${{ inputs.ref || 'main' }}
2323
fetch-depth: 0
24+
fetch-tags: true
2425

2526
- name: Configure Git
2627
run: |

.github/workflows/beta-release.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
get-configs:
9-
uses: ./.github/workflows/configs.yml
10-
11-
promote-main-to-beta:
12-
needs: [get-configs]
8+
create-beta-tag:
139
runs-on: ubuntu-latest
1410
permissions:
1511
contents: write
@@ -22,18 +18,12 @@ jobs:
2218
fetch-depth: 0
2319
fetch-tags: true
2420

25-
- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }}
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: ${{ needs.get-configs.outputs.node-version }}
29-
cache: 'npm'
30-
3121
- name: Configure Git
3222
run: |
3323
git config user.name "github-actions[bot]"
3424
git config user.email "github-actions[bot]@users.noreply.github.com"
3525
36-
- name: Bump Version and Tag
26+
- name: Tag
3727
id: version-and-tag
3828
run: |
3929
PKG_VERSION=$(jq -r .version package.json)
@@ -46,9 +36,9 @@ jobs:
4636
echo "tag=$FULL_TAG" >> $GITHUB_OUTPUT
4737
4838
call-release:
49-
needs: [promote-main-to-beta]
39+
needs: [create-beta-tag]
5040
uses: ./.github/workflows/release.yml
5141
permissions:
5242
contents: write
5343
with:
54-
tag: ${{ needs.promote-main-to-beta.outputs.tag }}
44+
tag: ${{ needs.create-beta-tag.outputs.tag }}

.github/workflows/configs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
env:
2020
NODE_VERSION: '22.x'
21-
GO_VERSION: '1.25.x'
21+
GO_VERSION: '1.25.4'
2222
outputs:
2323
node-version: ${{ env.NODE_VERSION }}
2424
go-version: ${{ env.GO_VERSION }}

.github/workflows/release.yml

Lines changed: 138 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
with:
3232
ref: ${{ inputs.tag }}
3333
fetch-tags: true
34-
34+
3535
- name: Get version from package.json
3636
id: get-version
3737
run: |
3838
VERSION=$(node -p "require('./package.json').version")
3939
echo "version=$VERSION" >> $GITHUB_OUTPUT
40-
40+
4141
- name: Validate tag matches version
4242
id: validate-tag
4343
run: |
@@ -59,33 +59,112 @@ jobs:
5959
fi
6060
6161
build-and-test:
62-
needs: [get-configs, version-and-tag]
62+
needs: [ get-configs, version-and-tag ]
6363
uses: ./.github/workflows/build-and-test.yml
6464
strategy:
6565
fail-fast: true
6666
matrix:
67-
os: [ubuntu-latest, windows-latest, macos-latest]
67+
os: [ ubuntu-22.04, windows-latest, macos-latest ]
6868
with:
6969
ref: ${{ needs.version-and-tag.outputs.tag }}
7070
runs-on: ${{ matrix.os }}
7171

72-
bundle-and-release:
73-
needs: [get-configs, version-and-tag, build-and-test]
74-
permissions:
75-
contents: write
72+
bundle-linux:
73+
needs: [ get-configs, version-and-tag, build-and-test ]
7674
strategy:
7775
fail-fast: true
7876
matrix:
7977
include:
80-
- { os: "ubuntu-latest", arch: "x64", platform: "linux", go-arch: "amd64" }
81-
- { os: "ubuntu-latest", arch: "arm64", platform: "linux", go-arch: "arm64" }
82-
- { os: "ubuntu-latest", arch: "arm", platform: "linux", go-arch: "arm" }
83-
- { os: "ubuntu-22.04", arch: "x64", platform: "linux", go-arch: "amd64" }
84-
- { os: "ubuntu-22.04", arch: "arm64", platform: "linux", go-arch: "arm64" }
85-
- { os: "ubuntu-22.04", arch: "arm", platform: "linux", go-arch: "arm" }
86-
- { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64" }
87-
- { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64" }
88-
- { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64" }
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
132+
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:
159+
needs: [ get-configs, version-and-tag, build-and-test ]
160+
strategy:
161+
fail-fast: true
162+
matrix:
163+
include:
164+
- { os: "macos-latest", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
165+
- { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
166+
- { 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" }
89168
runs-on: ${{ matrix.os }}
90169
steps:
91170
- uses: actions/checkout@v5
@@ -97,10 +176,10 @@ jobs:
97176
shell: bash
98177
run: echo "Bundling from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
99178

100-
- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} (${{ runner.os }})
179+
- name: Setup Node.js ${{ matrix.node-version }} (${{ runner.os }})
101180
uses: actions/setup-node@v4
102181
with:
103-
node-version: ${{ needs.get-configs.outputs.node-version }}
182+
node-version: ${{ matrix.node-version }}
104183
cache: 'npm'
105184

106185
- name: Setup Go ${{ needs.get-configs.outputs.go-version }} (${{ runner.os }})
@@ -117,11 +196,11 @@ jobs:
117196
run: |
118197
TAG=${{ needs.version-and-tag.outputs.tag }}
119198
if [[ "$TAG" =~ -alpha$ ]]; then
120-
npm run bundle:alpha -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
199+
npm run bundle:alpha
121200
elif [[ "$TAG" =~ -beta$ ]]; then
122-
npm run bundle:beta -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
201+
npm run bundle:beta
123202
else
124-
npm run bundle:prod -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
203+
npm run bundle:prod
125204
fi
126205
127206
- name: Bundle Go
@@ -144,47 +223,61 @@ jobs:
144223
VERSION=$(node -p "require('./package.json').version")
145224
PLATFORM=${{ matrix.platform }}
146225
ARCH=${{ matrix.arch }}
147-
148-
if [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then
149-
PLATFORM="linux22"
150-
fi
226+
NODE_VERSION=${{ matrix.node-version }}
227+
NODE_MAJOR=$(echo $NODE_VERSION | cut -d. -f1)
151228
152229
TAG=${{ needs.version-and-tag.outputs.tag }}
153230
if [[ "$TAG" =~ -alpha$ ]]; then
154-
FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}.zip"
231+
FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
155232
elif [[ "$TAG" =~ -beta$ ]]; then
156-
FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}.zip"
233+
FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
157234
else
158-
FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}.zip"
235+
FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}-node${NODE_MAJOR}"
159236
fi
160237
161238
ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
162239
echo "ASSET_NAME=${ASSET_NAME}"
163240
echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_OUTPUT
164241
165-
- name: Create Zip (Unix)
166-
if: runner.os != 'Windows'
167-
env:
168-
ASSET_NAME: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
169-
run: |
170-
echo "Creating zip: ${{ env.ASSET_NAME }}"
171-
(cd ./bundle/production && zip -r ../../${{ env.ASSET_NAME }} .)
242+
- name: Upload artifact
243+
uses: actions/upload-artifact@v4
244+
with:
245+
name: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
246+
path: bundle/production/
247+
if-no-files-found: error
248+
include-hidden-files: true
249+
compression-level: 6
172250

173-
- name: Create Zip (Windows)
174-
if: runner.os == 'Windows'
175-
env:
176-
ASSET_NAME: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
251+
release:
252+
needs: [ version-and-tag, bundle-linux, bundle-win-mac ]
253+
runs-on: ubuntu-latest
254+
permissions:
255+
contents: write
256+
steps:
257+
- name: Download all artifacts
258+
uses: actions/download-artifact@v5
259+
with:
260+
path: artifacts
261+
extract: false
262+
263+
- name: Create zip files for release
177264
run: |
178-
echo "Creating zip: ${{ env.ASSET_NAME }}"
179-
Compress-Archive -Path ./bundle/production/* -DestinationPath ./${{ env.ASSET_NAME }}
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
180275
181276
- name: Create GitHub Release
182277
uses: softprops/action-gh-release@v2
183-
env:
184-
ASSET_NAME: ${{ steps.set-asset-name.outputs.ASSET_NAME }}
185278
with:
186279
tag_name: ${{ needs.version-and-tag.outputs.tag }}
187280
prerelease: ${{ needs.version-and-tag.outputs.is-prerelease }}
188-
files: ${{ env.ASSET_NAME }}
281+
files: artifacts/*.zip
189282
generate_release_notes: true
190283
fail_on_unmatched_files: true

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)