Skip to content

Commit 92c4b40

Browse files
authored
chore: adding extension demo build workflow (#1597)
1 parent 622044d commit 92c4b40

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Build Namada Keychain Demo
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
REF:
6+
required: true
7+
type: string
8+
default: "main"
9+
10+
env:
11+
CI: false
12+
jobs:
13+
setup:
14+
runs-on: ubuntu-24.04
15+
outputs:
16+
VERSION: ${{ steps.set-environment-variables.outputs.VERSION }}
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{ inputs.REF }}
22+
23+
- name: Set environment variables
24+
id: set-environment-variables
25+
run: |
26+
COMMIT_HASH=$(git rev-parse --short $SHA)
27+
BASE_VERSION=$(node -e 'console.log(require("./apps/extension/package.json").version)')
28+
echo "VERSION=v$BASE_VERSION-$COMMIT_HASH" >> "$GITHUB_OUTPUT"
29+
env:
30+
SHA: ${{ github.sha }}
31+
32+
- name: Print workflow inputs
33+
uses: ./.github/actions/print-workflow-inputs
34+
35+
build-extension-chrome:
36+
needs: setup
37+
runs-on: ubuntu-24.04
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v3
41+
with:
42+
ref: ${{ inputs.REF }}
43+
44+
- name: Install yarn dependencies
45+
uses: ./.github/actions/yarn-cache
46+
47+
- name: Restore Rust cache
48+
uses: ./.github/actions/rust-cache
49+
with:
50+
cache-name: build
51+
52+
- name: Install protoc
53+
run: sudo apt-get install -y protobuf-compiler
54+
55+
- name: Build WASM dependencies
56+
working-directory: ./apps/extension
57+
run: yarn wasm:build
58+
59+
- name: Build the extension
60+
working-directory: ./apps/extension
61+
env:
62+
SHA: ${{ github.sha }}
63+
run: NAMADA_INTERFACE_REVISION=$SHA yarn build:chrome
64+
65+
- uses: actions/upload-artifact@v3
66+
with:
67+
name: namada-keychain-chrome
68+
path: ./apps/extension/build/chrome/namada_keychain-*.zip
69+
70+
build-extension-firefox:
71+
needs: setup
72+
runs-on: ubuntu-24.04
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@v3
76+
with:
77+
ref: ${{ inputs.REF }}
78+
79+
- name: Install yarn dependencies
80+
uses: ./.github/actions/yarn-cache
81+
82+
- name: Restore Rust cache
83+
uses: ./.github/actions/rust-cache
84+
with:
85+
cache-name: build
86+
87+
- name: Install protoc
88+
run: sudo apt-get install -y protobuf-compiler
89+
90+
- name: Build WASM dependencies
91+
working-directory: ./apps/extension
92+
run: yarn wasm:build
93+
94+
- name: Build the extension
95+
working-directory: ./apps/extension
96+
env:
97+
SHA: ${{ github.sha }}
98+
run: NAMADA_INTERFACE_REVISION=$SHA yarn build:firefox
99+
100+
- uses: actions/upload-artifact@v3
101+
with:
102+
name: namada-keychain-firefox
103+
path: ./apps/extension/build/firefox/namada_keychain-*.zip
104+
105+
release:
106+
needs: [setup, build-extension-chrome, build-extension-firefox]
107+
runs-on: ubuntu-24.04
108+
steps:
109+
- name: Download Chrome extension build
110+
uses: actions/download-artifact@v3
111+
with:
112+
name: namada-keychain-chrome
113+
path: ./namada-keychain-chrome
114+
115+
- name: Download Firefox extension build
116+
uses: actions/download-artifact@v3
117+
with:
118+
name: namada-keychain-firefox
119+
path: ./namada-keychain-firefox
120+
121+
- name: Get extension filenames
122+
id: get-filenames
123+
run: |
124+
echo "CHROME_FILENAME=$(ls -1 ./namada-keychain-chrome)" >> "$GITHUB_OUTPUT"
125+
echo "FIREFOX_FILENAME=$(ls -1 ./namada-keychain-firefox)" >> "$GITHUB_OUTPUT"
126+
127+
- name: Make release body text
128+
run: |
129+
echo "NAMADA_INTERFACE_REVISION: $SHA" >> RELEASE
130+
env:
131+
SHA: ${{ github.sha }}
132+
133+
- name: Create release
134+
id: create-release
135+
uses: actions/create-release@v1
136+
env:
137+
GITHUB_TOKEN: ${{ github.token }}
138+
with:
139+
release_name: ${{ needs.setup.outputs.VERSION }}
140+
tag_name: ${{ needs.setup.outputs.VERSION }}
141+
body_path: ./RELEASE
142+
143+
- name: Add Chrome extension to release
144+
uses: actions/upload-release-asset@v1
145+
env:
146+
GITHUB_TOKEN: ${{ github.token }}
147+
with:
148+
upload_url: ${{ steps.create-release.outputs.upload_url }}
149+
asset_path: ./namada-keychain-chrome/${{ steps.get-filenames.outputs.CHROME_FILENAME }}
150+
asset_name: namada-keychain-chrome_${{ needs.setup.outputs.VERSION }}.zip
151+
asset_content_type: application/zip
152+
153+
- name: Add Firefox extension to release
154+
uses: actions/upload-release-asset@v1
155+
env:
156+
GITHUB_TOKEN: ${{ github.token }}
157+
with:
158+
upload_url: ${{ steps.create-release.outputs.upload_url }}
159+
asset_path: ./namada-keychain-firefox/${{ steps.get-filenames.outputs.FIREFOX_FILENAME }}
160+
asset_name: namada-keychain-firefox_${{ needs.setup.outputs.VERSION }}.zip
161+
asset_content_type: application/zip

0 commit comments

Comments
 (0)