-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (33 loc) · 1.1 KB
/
publish.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
name: Publish package to GitHub Packages
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@octocat'
cache: 'yarn'
- name: Set package version
run: |
# Commit the updated package.json
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# Update the package.json version
yarn version --new-version ${{ github.event.release.tag_name }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn publish --new-version ${{ github.event.release.tag_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}