Skip to content

Commit d731cd8

Browse files
authored
Publish package to NPM (#162)
## Done - Update action versions - Update node versions - NPM Publish workflows ## Results - Working Publish RC run: https://github.com/AmplicaLabs/siwf/actions/runs/8512290132 - NPM Package: https://www.npmjs.com/package/@amplica-labs/siwf
1 parent 5bea6dc commit d731cd8

File tree

14 files changed

+235
-103
lines changed

14 files changed

+235
-103
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: CI
66

77
on:
88
pull_request:
9-
branches: ['main', 'chore/git-ci']
9+
branches: ['main']
1010

1111
jobs:
1212
build:
@@ -26,7 +26,7 @@ jobs:
2626
node-version: ${{ matrix.node-version }}
2727

2828
- name: Install pnpm
29-
uses: pnpm/action-setup@v2
29+
uses: pnpm/action-setup@v3
3030
with:
3131
version: 8
3232

@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
3737
- name: Setup pnpm cache
38-
uses: actions/cache@v3
38+
uses: actions/cache@v4
3939
with:
4040
path: ${{ env.STORE_PATH }}
4141
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -68,7 +68,7 @@ jobs:
6868
node-version: ${{ matrix.node-version }}
6969

7070
- name: Install pnpm
71-
uses: pnpm/action-setup@v2
71+
uses: pnpm/action-setup@v3
7272
with:
7373
version: 8
7474

@@ -77,7 +77,7 @@ jobs:
7777
run: |
7878
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
7979
- name: Setup pnpm cache
80-
uses: actions/cache@v3
80+
uses: actions/cache@v4
8181
with:
8282
path: ${{ env.STORE_PATH }}
8383
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
@@ -110,7 +110,7 @@ jobs:
110110
node-version: ${{ matrix.node-version }}
111111

112112
- name: Install pnpm
113-
uses: pnpm/action-setup@v2
113+
uses: pnpm/action-setup@v3
114114
with:
115115
version: 8
116116

@@ -119,7 +119,7 @@ jobs:
119119
run: |
120120
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
121121
- name: Setup pnpm cache
122-
uses: actions/cache@v3
122+
uses: actions/cache@v4
123123
with:
124124
path: ${{ env.STORE_PATH }}
125125
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

.github/workflows/deploy.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
node-version: ${{ matrix.node-version }}
2323

2424
- name: Install pnpm
25-
uses: pnpm/action-setup@v2
25+
uses: pnpm/action-setup@v3
2626
with:
2727
version: 8
2828

@@ -44,7 +44,7 @@ jobs:
4444
mv ./packages/example/build/* ./siwf/example
4545
4646
- name: Upload Artifacts
47-
uses: actions/upload-pages-artifact@v1
47+
uses: actions/upload-pages-artifact@v3
4848
with:
4949
# this should match the `pages` option in adapter-static options
5050
path: 'siwf/'
@@ -64,4 +64,59 @@ jobs:
6464
steps:
6565
- name: Deploy
6666
id: deployment
67-
uses: actions/deploy-pages@v1
67+
uses: actions/deploy-pages@v4
68+
69+
publish-npm-rc:
70+
name: Publish NPM Release Candidate
71+
runs-on: ubuntu-latest
72+
strategy:
73+
matrix:
74+
node-version: [20.x]
75+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
80+
- name: Install Node.js ${{ matrix.node-version }}
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: ${{ matrix.node-version }}
84+
85+
- name: Install pnpm
86+
uses: pnpm/action-setup@v3
87+
with:
88+
version: 8
89+
90+
- name: Get pnpm store directory
91+
shell: bash
92+
run: |
93+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
94+
95+
- name: Setup pnpm cache
96+
uses: actions/cache@v4
97+
with:
98+
path: ${{ env.STORE_PATH }}
99+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
100+
restore-keys: |
101+
${{ runner.os }}-pnpm-store-
102+
103+
- name: Install dependencies
104+
run: pnpm install --filter @amplica-labs/siwf
105+
106+
- name: build
107+
run: pnpm run build --filter @amplica-labs/siwf
108+
109+
- name: Version Package
110+
env:
111+
FULL_SHA: ${{github.sha}}
112+
working-directory: packages/siwf/dist
113+
shell: bash
114+
run: npm version --new-version "v0.0.0-${FULL_SHA:0:6}" --no-git-tag-version
115+
116+
# Required for Granular Access Tokens
117+
- name: NPM Access Config
118+
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NODE_AUTH_TOKEN}}
119+
120+
- name: Publish on NPM @next
121+
run: npm publish --verbose --tag next --access public
122+
working-directory: packages/siwf/dist

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Release
4+
run-name: Publish Release ${{github.ref_name}}
5+
concurrency:
6+
group: ${{github.workflow}}-${{github.ref}}
7+
cancel-in-progress: false
8+
on:
9+
push:
10+
tags:
11+
- 'v[0-9]+.[0-9]+.[0-9]+' # ex. v1.0.0
12+
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # ex. v1.1.0-rc1
13+
- 'v0.0.1' # used for testing only
14+
- 'v0.0.1-rc[0-9]+' # used for testing only
15+
16+
env:
17+
NEW_RELEASE_TAG: ${{github.ref_name}}
18+
TEST_RUN: ${{startsWith(github.ref_name, 'v0.0.1')}}
19+
20+
jobs:
21+
publish-npm:
22+
name: Publish NPM Package
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
node-version: [20.x]
27+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Install Node.js ${{ matrix.node-version }}
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
37+
- name: Install pnpm
38+
uses: pnpm/action-setup@v3
39+
with:
40+
version: 8
41+
42+
- name: Get pnpm store directory
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
46+
47+
- name: Setup pnpm cache
48+
uses: actions/cache@v4
49+
with:
50+
path: ${{ env.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- name: Install dependencies
56+
run: pnpm install --filter @amplica-labs/siwf
57+
58+
- name: build
59+
run: pnpm run build --filter @amplica-labs/siwf
60+
61+
- name: Version Package
62+
if: env.TEST_RUN != 'true'
63+
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version
64+
working-directory: packages/siwf/dist
65+
66+
# Required for Granular Access Tokens
67+
- name: NPM Access Config
68+
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NODE_AUTH_TOKEN}}
69+
70+
- name: Release on NPM @latest
71+
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release == 'true'
72+
run: npm publish --tag latest --access public
73+
working-directory: packages/siwf/dist
74+
75+
- name: Release Candidate on NPM
76+
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release != 'true'
77+
run: npm publish --access public
78+
working-directory: packages/siwf/dist

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.1

.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.tool-versions

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
nodejs 20.10.0
1+
nodejs 20.11.1
22
pnpm 8.12.1
3-

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Sign-In With Frequency (SIWF)
22

3+
Easy setup and validation for Sign-In With Frequency.
4+
35
## Description
46

57
SIWF is an application that facilitates using a selected Polkadot-compatible crypto wallet to perform sign-in and
@@ -51,7 +53,7 @@ onboarding. The user/data flows will look as follows:
5153
// The url where SIWF UI lives
5254
proxyUrl: 'https://amplicalabs.github.io/siwf/ui',
5355
// The Frequency RPC endpoint
54-
frequencyRpcUrl: 'https://rpc.rococo.frequency.xyz',
56+
frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',
5557
siwsOptions: {
5658
// The expiration for the SIWS payload.
5759
expiresInMsecs: 1000,

packages/example/src/routes/+page.svelte

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
if (process.env.BUILD_TARGET === 'production') {
1919
setConfig({
2020
proxyUrl: 'https://amplicalabs.github.io/siwf/ui',
21-
frequencyRpcUrl: 'https://rpc.rococo.frequency.xyz',
21+
frequencyRpcUrl: 'https://0.rpc.frequency.xyz',
2222
});
2323
}
2424
@@ -64,11 +64,6 @@
6464
http: 'https://rpc.rococo.frequency.xyz',
6565
ws: 'wss://rpc.rococo.frequency.xyz',
6666
},
67-
{
68-
name: 'Frequency Rococo Dwellir',
69-
http: 'https://frequency-rococo-rpc.dwellir.com',
70-
ws: 'wss://frequency-rococo-rpc.dwellir.com',
71-
},
7267
];
7368
7469
type ProxyUrl = {

packages/siwf/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "@amplica-labs/siwf",
33
"private": false,
4-
"version": "0.1.0",
4+
"version": "0.0.0",
55
"type": "module",
66
"files": ["dist", "!dist/**/*.test.*", "!dist/**/*.spec.*"],
77
"main": "./dist/index.umd.cjs",
88
"module": "./dist/index.js",
99
"types": "./dist/index.d.ts",
10+
"license": "Apache-2.0",
1011
"exports": {
1112
".": {
1213
"import": "./dist/index.js",

packages/siwf/scripts/package.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fs.rmSync(path.join(__dirname, '../dist/vite.svg'));
1717
const rootPackage = require('../package.json');
1818

1919
// Don't keep scripts
20-
delete rootPackage['scripts'];
20+
rootPackage['scripts'] = {};
2121

2222
// Don't keep file reference
2323
delete rootPackage['files'];

0 commit comments

Comments
 (0)