-
Notifications
You must be signed in to change notification settings - Fork 133
70 lines (60 loc) · 1.83 KB
/
publish-github-packages.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Publish to Github Packages
on:
workflow_dispatch:
inputs:
packageVersion:
description: "The version to publish (e.g. prerelease, patch, major, new-version 1.2.3)"
required: true
default: "prerelease"
distTag:
description: "The dist-tag to publish (e.g. latest, beta)"
required: true
default: "latest"
jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to do a release
uses: "lannonbr/[email protected]"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Publish to Github Packages
runs-on: ubuntu-latest
needs: [authorize]
env:
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
DIST_TAG: ${{ github.event.inputs.distTag }}
strategy:
matrix:
node-version: [ 16.x ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Lint
run: yarn lint
- name: Test
run: yarn test
- name: Set registry url
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'
- name: Publish
run: |
sed -i 's,"name": "amplitude-js","name": "@amplitude/amplitude-js",' package.json
cat package.json
yarn publish --${{ env.PACKAGE_VERSION }} --tag ${{ env.DIST_TAG }} --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}