Skip to content

Commit a765a59

Browse files
committed
ci: set workflow permissions for release job
We had the issue that the github action wasnt able to push tags to github. This should fix the issue ref: #1828
1 parent 412eab8 commit a765a59

File tree

1 file changed

+49
-46
lines changed

1 file changed

+49
-46
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
11
name: Release
22

3+
permissions:
4+
contents: write
5+
36
on:
4-
workflow_dispatch:
5-
inputs:
6-
releaseVersion:
7-
type: string
8-
required: true
9-
description: The version of this release. Must be a semantic version of the form X.Y.Z.
10-
dry_run:
11-
type: boolean
12-
required: true
13-
default: false
14-
description: Dry run, will not push branches or upload the artifacts.
15-
skip_tag:
16-
type: boolean
17-
required: true
18-
default: false
19-
description: If true, don't tag this release, just push it.
7+
workflow_dispatch:
8+
inputs:
9+
releaseVersion:
10+
type: string
11+
required: true
12+
description: The version of this release. Must be a semantic version of the form X.Y.Z.
13+
dry_run:
14+
type: boolean
15+
required: true
16+
default: false
17+
description: Dry run, will not push branches or upload the artifacts.
18+
skip_tag:
19+
type: boolean
20+
required: true
21+
default: false
22+
description: If true, don't tag this release, just push it.
2023

2124
jobs:
22-
release:
23-
runs-on: ubuntu-latest
24-
environment: production
25-
steps:
26-
- name: Checkout Javascript
27-
uses: actions/checkout@v4
28-
- name: Setup Node
29-
uses: actions/setup-node@v4
30-
with:
31-
node-version: '20'
32-
registry-url: 'https://registry.npmjs.org'
33-
- name: Install dependencies
34-
run: npm install
35-
- name: Package
36-
run: ./build-package.sh
37-
- name: Upload pre-release
38-
if: ${{ github.event.inputs.dry_run != 'true' }}
39-
run: npm publish --tag next
40-
env:
41-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
42-
- name: Tag release
43-
if: ${{ github.event.inputs.skip_tag != 'true' }}
44-
run: |
45-
git config --global user.name 'Github Bot'
46-
git config --global user.email '<>'
47-
git tag ${{ github.events.inputs.version }}
48-
- name: Push tag
49-
if: ${{ github.event.inputs.dry_run != 'true' }}
50-
run: |
51-
git push ${{ github.events.inputs.version }}
25+
release:
26+
runs-on: ubuntu-latest
27+
environment: production
28+
steps:
29+
- name: Checkout Javascript
30+
uses: actions/checkout@v4
31+
- name: Setup Node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '20'
35+
registry-url: 'https://registry.npmjs.org'
36+
- name: Install dependencies
37+
run: npm install
38+
- name: Package
39+
run: ./build-package.sh
40+
- name: Upload pre-release
41+
if: ${{ github.event.inputs.dry_run != 'true' }}
42+
run: npm publish --tag next
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
45+
- name: Tag release
46+
if: ${{ github.event.inputs.skip_tag != 'true' }}
47+
run: |
48+
git config --global user.name 'Github Bot'
49+
git config --global user.email '<>'
50+
git tag ${{ github.events.inputs.version }}
51+
- name: Push tag
52+
if: ${{ github.event.inputs.dry_run != 'true' }}
53+
run: |
54+
git push ${{ github.events.inputs.version }}

0 commit comments

Comments
 (0)