Skip to content

Commit aad887e

Browse files
committed
ci: add test job and reorder release workflow
- Add tests job that runs before build to ensure code quality - Move publish-npm job to run before release creation - Update GitHub Actions versions (checkout@v6.0.1, setup-go@v6.1.0, setup-node@v6.1.0, download-artifact@v7.0.0) - Upgrade Go version from 1.21 to 1.24.5 - Update job dependencies to reflect new execution order (build needs tests, publish-npm needs build, release needs publish-npm)
1 parent 1c3caf3 commit aad887e

File tree

2 files changed

+49
-31
lines changed

2 files changed

+49
-31
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@ permissions:
1010
id-token: write
1111

1212
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v6.0.1
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v6.1.0
21+
with:
22+
go-version: "1.24.5"
23+
24+
- name: Run tests
25+
run: go test ./...
26+
1327
build:
1428
name: Build binaries
29+
needs: tests
1530
runs-on: ${{ matrix.os }}
1631
strategy:
1732
matrix:
@@ -35,12 +50,12 @@ jobs:
3550

3651
steps:
3752
- name: Checkout code
38-
uses: actions/checkout@v4
53+
uses: actions/checkout@v6.0.1
3954

4055
- name: Set up Go
41-
uses: actions/setup-go@v5
56+
uses: actions/setup-go@v6.1.0
4257
with:
43-
go-version: "1.21"
58+
go-version: "1.24.5"
4459

4560
- name: Get dependencies
4661
run: go mod download
@@ -59,16 +74,41 @@ jobs:
5974
name: ${{ matrix.artifact_name }}
6075
path: ${{ matrix.artifact_name }}
6176

77+
publish-npm:
78+
name: Publish to NPM
79+
needs: build
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v6.0.1
84+
85+
- name: Setup Node.js
86+
uses: actions/setup-node@v6.1.0
87+
with:
88+
node-version: "22"
89+
registry-url: "https://registry.npmjs.org"
90+
91+
- name: Update package version
92+
working-directory: ./npm
93+
run: |
94+
VERSION=${GITHUB_REF#refs/tags/v}
95+
npm version $VERSION --no-git-tag-version --allow-same-version
96+
97+
- name: Publish to NPM
98+
working-directory: ./npm
99+
run: npm publish --access public
100+
101+
62102
release:
63103
name: Create Release
64-
needs: build
104+
needs: publish-npm
65105
runs-on: ubuntu-latest
66106
steps:
67107
- name: Checkout code
68-
uses: actions/checkout@v4
108+
uses: actions/checkout@v6.0.1
69109

70110
- name: Download all artifacts
71-
uses: actions/download-artifact@v4
111+
uses: actions/download-artifact@v7.0.0
72112
with:
73113
path: ./artifacts
74114

@@ -86,28 +126,4 @@ jobs:
86126
prerelease: false
87127
body_path: RELEASE.md
88128
env:
89-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90-
91-
publish-npm:
92-
name: Publish to NPM
93-
needs: release
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: Checkout code
97-
uses: actions/checkout@v4
98-
99-
- name: Setup Node.js
100-
uses: actions/setup-node@v4
101-
with:
102-
node-version: "22"
103-
registry-url: "https://registry.npmjs.org"
104-
105-
- name: Update package version
106-
working-directory: ./npm
107-
run: |
108-
VERSION=${GITHUB_REF#refs/tags/v}
109-
npm version $VERSION --no-git-tag-version --allow-same-version
110-
111-
- name: Publish to NPM
112-
working-directory: ./npm
113-
run: npm publish --access public
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RELEASE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- Removed duplicated validation and prompt logic across create flows
1414
- Eliminated inconsistent success messages between feature, resource, and standalone creation
1515
- Test `resource_builder_test` fixed, to add dependencies
16+
- CI: fix in push with `Trusted Publisher` and tests added
17+
- Updated all CI actions
1618

1719
### Notes
1820
- No breaking changes

0 commit comments

Comments
 (0)