Skip to content

Commit b353143

Browse files
committed
fix: update GitHub Actions workflow for releases and publish:
- Rename workflow to "Release and Publish." - Change branch trigger from `master` to `main.` - Refactor job structure and permissions. - Add `.npmrc` configuration for scoped package registry. - Update Node.js setup with `lts/*` and token usage for semantic release.
1 parent 8b67ab6 commit b353143

2 files changed

Lines changed: 28 additions & 18 deletions

File tree

.github/workflows/main.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
name: Automated publish
2-
1+
name: Release and Publish
32
on:
43
push:
5-
branches: [master]
4+
branches: [main]
65

76
jobs:
8-
9-
publish:
7+
release:
8+
name: Release
109
runs-on: ubuntu-latest
11-
if: ${{ github.ref == 'refs/heads/master' }}
10+
permissions:
11+
contents: write
12+
packages: write
13+
issues: write
14+
pull-requests: write
15+
env:
16+
NODE_AUTH_TOKEN: ${{ secrets.PAT_GITHUB }}
17+
1218
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v2
19+
20+
- name: Checkout
21+
uses: actions/checkout@v4
1522
with:
16-
node-version: 16
17-
registry-url: https://registry.npmjs.org
23+
fetch-depth: 0
1824

19-
- uses: filipstefansson/set-npm-token-action@v1
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
2027
with:
21-
token: ${{secrets.NPM_AUTH_TOKEN}}
28+
node-version: 'lts/*'
29+
registry-url: 'https://npm.pkg.github.com'
30+
scope: '@videsk'
2231

2332
- name: Install dependencies
2433
run: npm ci
25-
env:
26-
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
2734

2835
- name: Build
2936
run: npm run build
3037

31-
- name: Set semantic release
32-
run: npx semantic-release
38+
- name: Release
3339
env:
34-
NPM_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
35-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
npm_config_token: ${{ secrets.GITHUB_TOKEN }}
42+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: npx semantic-release

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@videsk:registry=https://npm.pkg.github.com
2+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

0 commit comments

Comments
 (0)