-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (110 loc) · 3.56 KB
/
build-and-release.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build, Release, Deploy
on:
workflow_dispatch:
release:
types: [created] # Trigger when a new release is created
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build_release:
name: Build release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Binstall
uses: cargo-bins/cargo-binstall@main
- name: Set up Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown, wasm32-wasi
toolchain: nightly-x86_64-unknown-linux-gnu
components: rust-src, rustfmt
- name: Install cargo component v0.13.2
run: echo yes | cargo binstall cargo-component@0.13.2
- name: Run binstall just, wasm-tools
run: |
cargo binstall just --no-confirm
cargo binstall wasm-tools --no-confirm
- name: Build and Compose Wasm
run: |
just build-submodules
just compose
- name: Archive build
uses: actions/upload-artifact@v4
with:
name: wasm-artifact
path: dist/peerpiper_wallet_aggregate.wasm
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: dist/peerpiper_wallet_aggregate.wasm
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set VITE_BASE
run: |
echo "VITE_BASE=https://${GITHUB_REPOSITORY_OWNER,,}.github.io/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Set BASE_PATH
run: |
echo "BASE_PATH=/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: "./packages/integrity-wallet/package-lock.json"
- name: Install dependencies
run: |
cd packages/integrity-wallet
npm install
cd inner-app
npm install
- name: build
env:
BASE_PATH: ${{ env.BASE_PATH }}
VITE_BASE: ${{ env.VITE_BASE }}
run: |
cd packages/integrity-wallet/inner-app
npm run build
cd ..
npm run build
# touch docs/.nojekyll
- name: Get version of inner-app
id: get_version
run: echo "VERSION=$(jq -r '.version' ./inner-app/package.json)" >> $GITHUB_ENV
- name: Commit built dist
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add dist/$VERSION
git commit -m "Add dist build for version $VERSION"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
VERSION: ${{ env.VERSION }}
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
# this should match the `pages` option in your adapter-static options
path: "packages/integrity-wallet/docs/"
deploy:
needs: build_release
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4