Skip to content

Commit 44e8fd9

Browse files
committed
Support V1 and V2
1 parent bade151 commit 44e8fd9

File tree

6 files changed

+159
-85
lines changed

6 files changed

+159
-85
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
3-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
4-
52
name: CI
63

74
on:
@@ -26,7 +23,7 @@ jobs:
2623
node-version: ${{ matrix.node-version }}
2724

2825
- name: Install pnpm
29-
uses: pnpm/action-setup@v3
26+
uses: pnpm/action-setup@v4
3027
with:
3128
version: 8
3229

@@ -68,7 +65,7 @@ jobs:
6865
node-version: ${{ matrix.node-version }}
6966

7067
- name: Install pnpm
71-
uses: pnpm/action-setup@v3
68+
uses: pnpm/action-setup@v4
7269
with:
7370
version: 8
7471

@@ -110,7 +107,7 @@ jobs:
110107
node-version: ${{ matrix.node-version }}
111108

112109
- name: Install pnpm
113-
uses: pnpm/action-setup@v3
110+
uses: pnpm/action-setup@v4
114111
with:
115112
version: 8
116113

Lines changed: 5 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,14 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2-
name: Deploy to GitHub Pages
2+
name: Deploy NPM Hash
33

44
on:
55
push:
66
branches: ['main']
77
env:
88
BUILD_TARGET: 'production'
99
jobs:
10-
build_site:
11-
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
node-version: [20.x]
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v4
18-
19-
- name: Install Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v4
21-
with:
22-
node-version: ${{ matrix.node-version }}
23-
24-
- name: Install pnpm
25-
uses: pnpm/action-setup@v3
26-
with:
27-
version: 8
28-
29-
- name: Install dependencies
30-
run: pnpm install
31-
32-
- name: build
33-
env:
34-
BASE_PATH: '/siwf'
35-
run: |
36-
pnpm run build
37-
- name: structure
38-
run: |
39-
mkdir siwf
40-
touch siwf/.nojekyll
41-
mkdir siwf/example
42-
mkdir siwf/ui
43-
mv ./packages/ui/build/* ./siwf/ui
44-
mv ./packages/example/build/* ./siwf/example
45-
46-
- name: Upload Artifacts
47-
uses: actions/upload-pages-artifact@v3
48-
with:
49-
# this should match the `pages` option in adapter-static options
50-
path: 'siwf/'
51-
52-
deploy:
53-
needs: build_site
54-
runs-on: ubuntu-latest
55-
56-
permissions:
57-
pages: write
58-
id-token: write
59-
60-
environment:
61-
name: github-pages
62-
url: ${{ steps.deployment.outputs.page_url }}
63-
64-
steps:
65-
- name: Deploy
66-
id: deployment
67-
uses: actions/deploy-pages@v4
68-
6910
publish-npm-rc:
70-
name: Publish NPM Release Candidate
11+
name: Publish NPM Hash
7112
runs-on: ubuntu-latest
7213
strategy:
7314
matrix:
@@ -83,7 +24,7 @@ jobs:
8324
node-version: ${{ matrix.node-version }}
8425

8526
- name: Install pnpm
86-
uses: pnpm/action-setup@v3
27+
uses: pnpm/action-setup@v4
8728
with:
8829
version: 8
8930

@@ -117,6 +58,6 @@ jobs:
11758
- name: NPM Access Config
11859
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_AUTH_TOKEN}}
11960

120-
- name: Publish on NPM @next
121-
run: npm publish --verbose --tag next --access public
61+
- name: Publish on NPM
62+
run: npm publish --verbose --access public
12263
working-directory: packages/siwf/dist

.github/workflows/deploy-pages.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
name: Deploy to GitHub Pages
3+
4+
on:
5+
push:
6+
branches: ['main', 'v1']
7+
env:
8+
BUILD_TARGET: 'production'
9+
TARGET_FOLDER: ${{ github.ref == 'refs/heads/main' && 'v2' || 'v1' }}
10+
jobs:
11+
build_site:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [20.x]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 8
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: build
34+
env:
35+
BASE_PATH: '/siwf'
36+
run: |
37+
pnpm run build
38+
- name: structure
39+
run: |
40+
mkdir siwf
41+
touch siwf/.nojekyll
42+
mkdir siwf/example
43+
mkdir siwf/ui
44+
mv ./packages/ui/build/* ./siwf/ui
45+
mv ./packages/example/build/* ./siwf/example
46+
47+
- name: Deploy to GitHub Pages ${{ env.TARGET_FOLDER }}
48+
uses: JamesIves/github-pages-deploy-action@v4
49+
with:
50+
branch: gh-pages
51+
folder: siwf
52+
target-folder: ${{ env.TARGET_FOLDER }} # This is what deploys us to a v1 or v2 directory
53+
clean: false # Don't clean up the other release folders
54+
55+
# For now, we want to keep deploying v1 to the root
56+
# Future will swap this to some basic directory page
57+
- name: Deploy to GitHub Pages Root
58+
if: ${{ github.ref == 'refs/heads/v1' }}
59+
uses: JamesIves/github-pages-deploy-action@v4
60+
with:
61+
branch: gh-pages
62+
folder: siwf
63+
target-folder: /
64+
clean: false # Don't clean up the release folders

.github/workflows/release-v1.yml

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

.github/workflows/release.yml renamed to .github/workflows/release-v2.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
22

3-
name: Release
3+
name: Release v2
44
run-name: Publish Release ${{github.ref_name}}
55
concurrency:
66
group: ${{github.workflow}}-${{github.ref}}
77
cancel-in-progress: false
88
on:
99
push:
1010
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
11+
- 'v2.[0-9]+.[0-9]+' # ex. v2.0.0
12+
- 'v2.[0-9]+.[0-9]+-rc[0-9]+' # ex. v2.1.0-rc1
1513

1614
env:
1715
NEW_RELEASE_TAG: ${{github.ref_name}}
18-
TEST_RUN: ${{startsWith(github.ref_name, 'v0.0.1')}}
16+
# Version 1.0 should NEVER be latest anymore
17+
NPM_LATEST: ${{!contains(fromJSON('["-rc", "v0.0.", "v1."]'), github.ref_name)}}
1918

2019
jobs:
2120
publish-npm:
@@ -35,7 +34,7 @@ jobs:
3534
node-version: ${{ matrix.node-version }}
3635

3736
- name: Install pnpm
38-
uses: pnpm/action-setup@v3
37+
uses: pnpm/action-setup@v4
3938
with:
4039
version: 8
4140

@@ -59,7 +58,6 @@ jobs:
5958
run: pnpm run build --filter @projectlibertylabs/siwf
6059

6160
- name: Version Package
62-
if: env.TEST_RUN != 'true'
6361
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version
6462
working-directory: packages/siwf/dist
6563

@@ -68,11 +66,11 @@ jobs:
6866
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_AUTH_TOKEN}}
6967

7068
- name: Release on NPM @latest
71-
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release == 'true'
69+
if: env.NPM_LATEST == 'true'
7270
run: npm publish --tag latest --access public
7371
working-directory: packages/siwf/dist
7472

7573
- name: Release Candidate on NPM
76-
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release != 'true'
74+
if: env.NPM_LATEST != 'true'
7775
run: npm publish --access public
7876
working-directory: packages/siwf/dist

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Sign-In With Frequency (SIWF)
1+
# Sign-In With Frequency (SIWF) V1
2+
3+
> [!WARNING]
4+
> This is the README and documentation for SIWF v1.
5+
> You likely want to be looking at [a newer version](https://github.com/ProjectLibertyLabs/siwf).
26
37
Easy setup and validation for Sign-In With Frequency.
48

@@ -16,7 +20,7 @@ onboarding operations over Frequency.
1620

1721
### Description
1822

19-
SIWF has two parts: a package `@projectlibertylabs/siwf` and a deployed web application that performs the needed UI for
23+
SIWF has two parts: a package `@projectlibertylabs/siwf@v1` and a deployed web application that performs the needed UI for
2024
assisting the user in the action of login or onboarding. The UI also assists with interfacing with various wallets is
2125
achieved through interaction with either a supported browser extension (web/mobile) or an installed native app (mobile
2226
only)
@@ -33,14 +37,14 @@ onboarding. The user/data flows will look as follows:
3337

3438
### Creating a Sign-up/Sign-in Button
3539

36-
1. Install the SIWF package `npm i @projectlibertylabs/siwf`
40+
1. Install the SIWF package `npm i @projectlibertylabs/siwf@v1`
3741

3842
2. Import the `setConfig` and `getLoginOrRegistrationPayload` functions.
3943
3. `setConfig` is used to set the URL to the current production siwf-ui. The current deployed environment is via GitHub
4044
pages at:
4145

4246
```
43-
https://projectlibertylabs.github.io/siwf/ui
47+
https://projectlibertylabs.github.io/siwf/v1/ui
4448
```
4549

4650
Note: For SIWF development replace with the address the local application runs on.
@@ -51,7 +55,7 @@ onboarding. The user/data flows will look as follows:
5155
// Your providerId
5256
providerId: '1',
5357
// The url where SIWF UI lives
54-
proxyUrl: 'https://projectlibertylabs.github.io/siwf/ui',
58+
proxyUrl: 'https://projectlibertylabs.github.io/siwf/v1/ui',
5559
// The Frequency RPC endpoint
5660
frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',
5761
siwsOptions: {

0 commit comments

Comments
 (0)