Skip to content

Commit 7b85654

Browse files
committed
Add workflow
1 parent f3b19a5 commit 7b85654

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/build-publish.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: 📦🚀 Build & Publish
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
release:
9+
types: [published]
10+
pull_request:
11+
branches:
12+
- '**'
13+
14+
concurrency:
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v3
24+
25+
- name: Set Common Job Env
26+
uses: Chia-Network/actions/setjobenv@main
27+
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
32+
- name: Update Version
33+
if: env.RELEASE == 'true'
34+
run: |
35+
jq --arg VER "$RELEASE_TAG" '.version=$VER' package.json > temp.json && mv temp.json package.json
36+
37+
- name: Install
38+
run: npm install
39+
40+
- name: Run Tests
41+
run: npm run test
42+
43+
- name: Build Library
44+
run: npm run build
45+
46+
- name: Upload Bundle to Artifacts
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: dist
50+
path: dist/
51+
52+
- name: Publish to NPM
53+
if: env.FULL_RELEASE == 'true'
54+
env:
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
run: |
57+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
58+
npm publish --access public
59+
60+
- name: Upload to Release
61+
if: env.RELEASE == 'true'
62+
env:
63+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
gh release upload \
66+
$RELEASE_TAG \
67+
dist/bundle.js
68+
69+
- name: Cleanup
70+
if: always()
71+
run: rm ${{ github.workspace }}/js_build/js-bindings/.npmrc || true

0 commit comments

Comments
 (0)