Skip to content

Commit f7b51d3

Browse files
authored
Merge pull request #73 from paritytech/anp-npm-release
chore(CI): add `npm_publish_automation` workflow
2 parents f230b45 + dabfcaf commit f7b51d3

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/npm-release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: NPM Hardhat-Polkadot Release
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
env:
8+
CI: true
9+
10+
jobs:
11+
publish:
12+
name: Build & Publish to NPM
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22.x
22+
23+
- name: Install
24+
run: pnpm install --frozen-lockfile
25+
26+
- name: Build
27+
run: pnpm build
28+
29+
- name: Set version
30+
run: npm version --no-git-tag-version ${{github.event.release.tag_name}}
31+
32+
- name: pack hardhat-polkadot-resolc
33+
run: npm pack
34+
working-directory: "./packages/hardhat-polkadot-resolc"
35+
36+
- name: pack hardhat-polkadot-node
37+
run: npm pack
38+
working-directory: "./packages/hardhat-polkadot-node"
39+
40+
- name: pack hardhat-polkadot
41+
run: npm pack
42+
working-directory: "./packages/hardhat-polkadot"
43+
44+
- name: move_to
45+
run: |
46+
mkdir -p packs
47+
cp ./packages/hardhat-polkadot-resolc/*.tgz packs/
48+
cp ./packages/hardhat-polkadot-node/*.tgz packs/
49+
cp ./packages/hardhat-polkadot/*.tgz packs/
50+
ls -ltr packs
51+
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: packages-${{ github.sha }}
55+
path: packs
56+
57+
- name: name: NPM Publish automation
58+
uses: octokit/request-action@bbedc70b1981e610d89f1f8de88311a1fc02fb83
59+
with:
60+
route: POST /repos/paritytech/npm_publish_automation/actions/workflows/publish.yml/dispatches
61+
ref: main
62+
inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}" }}'', github.repository, github.run_id) }}'
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.NPM_PUBLISH_AUTOMATION_TOKEN }}

0 commit comments

Comments
 (0)