Skip to content

Commit bf14a48

Browse files
authored
ci: collapse release workflow into single GHA workflow file (#148)
1 parent 7d4af5a commit bf14a48

File tree

2 files changed

+29
-57
lines changed

2 files changed

+29
-57
lines changed

.github/workflows/publish-npm.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,36 @@ jobs:
1212
uses: ./.github/workflows/test.yml
1313
with:
1414
electron-version: ${{ github.event.inputs.version }}
15-
tag_new_version:
15+
16+
release:
1617
runs-on: ubuntu-latest
17-
environment: deps-releaser
18+
environment: npm-trusted-publisher
1819
needs: test
20+
permissions:
21+
id-token: write # for publishing releases
22+
env:
23+
VERSION: ${{ github.event.inputs.version }}
1924
steps:
20-
- name: Generate GitHub App token
21-
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
22-
id: generate-token
23-
with:
24-
creds: ${{ secrets.DEPS_RELEASER_GH_APP_CREDS }}
25-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
25+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
- name: Setup Node.js
27+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
2628
with:
27-
token: ${{ steps.generate-token.outputs.token }}
28-
# Tag here, the publish-npm.yml workflow will trigger on the new tag and do the publish
29-
- name: Push New Tag
30-
run: |
31-
git tag ${{ github.event.inputs.version }}
32-
git push origin ${{ github.event.inputs.version }}
29+
node-version: "20.17.0"
30+
package-manager-cache: false
31+
- name: Update npm to version that supports trusted publishing
32+
run: npm install -g npm@^11.5.1
33+
- name: Update Version
34+
run: node script/update-version.js ${VERSION}
35+
- name: Confirm Version Updated
36+
run: node -e "if (require('./package.json').version === '0.0.0-development') process.exit(1)"
37+
- name: Install Dependencies
38+
run: yarn install --immutable
39+
- name: Get GitHub app token
40+
id: secret-service
41+
uses: electron/secret-service-action@3476425e8b30555aac15b1b7096938e254b0e155 # v1.0.0
42+
- name: Create Release
43+
env:
44+
GITHUB_TOKEN: ${{ fromJSON(steps.secret-service.outputs.secrets).GITHUB_TOKEN }}
45+
run: gh release create ${VERSION} -t ${VERSION}
46+
- name: Publish to npm
47+
run: npm publish --tag latest

0 commit comments

Comments
 (0)