Skip to content

Commit d01198f

Browse files
Set up trusted publishing
1 parent e2870fa commit d01198f

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ on:
1111
branches:
1212
- '*'
1313
- '!gh-pages'
14+
tags:
15+
- '*'
1416
pull_request:
1517
branches:
1618
- '*'
1719
- '!gh-pages'
1820

21+
# https://docs.npmjs.com/trusted-publishers#step-2-configure-your-cicd-workflow
22+
permissions:
23+
id-token: write
24+
contents: read
25+
1926
jobs:
2027
test:
2128
runs-on: macos-15
@@ -56,6 +63,26 @@ jobs:
5663
- run: make docs
5764
if: ${{ !cancelled() }}
5865

66+
publish:
67+
if: ${{ github.ref_type == 'tag' }}
68+
runs-on: macos-15
69+
needs: test
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: actions/setup-node@v6
73+
with:
74+
node-version-file: "./.tool-versions"
75+
- run: node --version
76+
- run: npm --version
77+
- run: npm ci
78+
- run: npm run build
79+
- run: npm publish --access public
80+
working-directory: ./packages/authgear-web/
81+
- run: npm publish --access public
82+
working-directory: ./packages/authgear-react-native/
83+
- run: npm publish --access public
84+
working-directory: ./packages/authgear-capacitor/
85+
5986
webapp-image:
6087
runs-on: ubuntu-24.04
6188
needs: test

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ $ (cd website && yarn install --frozen-lockfile)
7070

7171
## Releasing
7272

73-
- Ensure you have `node`, `npm`, and `yarn` in your `PATH`.
74-
- Sign in as appropriate user in npm.
75-
76-
```sh
77-
# VERSION should be in format like "0.1.0"
78-
$ GIT_USER=<github-username> GITHUB_TOKEN=<github-token> GIT_BRANCH=master VERSION=<new-version> ./scripts/release.sh
79-
```
73+
1. Ensure you have `node`, `npm`, `yarn`, `sed`, `git` in your `PATH`.
74+
2. Run `npm run set-version VERSION` to set the version. VERSION should be without the `v` at the beginning, for example, `1.0.0`.
75+
3. Commit the change.
76+
4. Create a pull request for this change.
77+
5. Wait for merge.
78+
6. Run `git tag -a vVERSION -m "Release vVERSION" MERGE_COMMIT`. MERGE_COMMIT should be the commit hash of the merge commit.
79+
7. Push the tag to `github.com/authgear/authgear-sdk-js`.
8080

8181
## Known issues
8282

scripts/release.sh

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

0 commit comments

Comments
 (0)