-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (47 loc) · 1.78 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# doc: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish Package to npmjs
run-name: ${{ github.actor }} publish to npm 🚀
# on:
# release:
# types: [published]
on:
push:
branches:
# Change this if your primary branch is not main
- main
- develop
permissions:
contents: read # for checkout
jobs:
build:
runs-on: ubuntu-latest
environment:
name: Grim #your environment name
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
# need this for using yarn
- name: Enable Corepack
run: corepack enable
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
# instead of using the local cache in .yarn folder, since it's in .gitignore
cache: 'yarn'
- run: yarn
# for Yarn v1, use `yarn publish` instead
# - run: yarn npm publish // if using yarn
# - name: Install semantic-release
# run: yarn add -g semantic-release @semantic-release/gitlab @semantic-release/changelog @semantic-release/git @semantic-release/npm @semantic-release/commit-analyzer conventional-changelog-conventionalcommits
- name: Release
env:
# this will be used in .yarnrc.yml
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release