forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (53 loc) · 1.72 KB
/
artifacts-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
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
name: Publish Artifacts
on:
workflow_dispatch:
jobs:
publish-artifacts-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'
- name: Configure NPM for Scoped Package
run: |
cd packages/artifacts
SCOPE=$(jq -r '.name' package.json | cut -d'/' -f1)
echo "$SCOPE:registry=https://registry.npmjs.org/" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Get Version from package.json
id: get_version
run: |
cd packages/artifacts
VERSION=$(jq -r '.version' package.json)
TAG_VERSION="v$VERSION"
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Create Git Tag
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git tag $VERSION
git push origin $VERSION
- name: Install Dependencies
run: |
cd packages/artifacts
yarn install
- name: Build Package
env:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
run: |
cd packages/artifacts
yarn build
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd packages/artifacts
if [[ "$VERSION" == *"-alpha"* ]]; then
npm publish --tag alpha --access public
else
npm publish --tag latest --access public
fi