Skip to content

Commit 2ae4ece

Browse files
chore: publish to Github packages workflow (#433)
* chore: added publish to GH packages workflow * chore: updated NODE_AUTH_TOKEN for GH packages publish
1 parent 94da0b6 commit 2ae4ece

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish to Github Packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
packageVersion:
7+
description: "The version to publish (e.g. prerelease, patch, major, new-version 1.2.3)"
8+
required: true
9+
default: "prerelease"
10+
distTag:
11+
description: "The dist-tag to publish (e.g. latest, beta)"
12+
required: true
13+
default: "latest"
14+
15+
jobs:
16+
authorize:
17+
name: Authorize
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: ${{ github.actor }} permission check to do a release
21+
uses: "lannonbr/repo-permission-check-action@2.0.2"
22+
with:
23+
permission: "write"
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
release:
28+
name: Publish to Github Packages
29+
runs-on: ubuntu-latest
30+
needs: [authorize]
31+
env:
32+
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
33+
DIST_TAG: ${{ github.event.inputs.distTag }}
34+
strategy:
35+
matrix:
36+
node-version: [ 14.x ]
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v2
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
cache: 'yarn'
46+
47+
- name: Install
48+
run: yarn install --frozen-lockfile
49+
50+
- name: Build
51+
run: yarn build
52+
53+
- name: Lint
54+
run: yarn lint
55+
56+
- name: Test
57+
run: yarn test
58+
59+
- name: Set registry url
60+
uses: actions/setup-node@v2
61+
with:
62+
registry-url: 'https://npm.pkg.github.com'
63+
64+
- name: Publish
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
run: |
68+
yarn publish --${{ env.PACKAGE_VERSION }} --tag ${{ env.DIST_TAG }} --no-git-tag-version

0 commit comments

Comments
 (0)