Skip to content

Commit 296bdb8

Browse files
authored
chore: deploy to asset canister (#221)
* Turn repo into an `icp` project * add `release-icp-cli.yaml` workflow that deploys the docs site using the asset canister * Identity is stored in repo secret `ICP_IDENTITY_DEPLOY`. It is a controller of the canister and has `Commit` permissions Deploys to https://ixpgz-eiaaa-aaaap-qumoq-cai.icp0.io
1 parent b53c093 commit 296bdb8

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release (ICP-CLI)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: production-icp
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy-ic:
15+
name: "Deploy to IC"
16+
runs-on: ubuntu-latest
17+
18+
environment:
19+
name: production
20+
url: ${{ steps.get-url.outputs.url }}
21+
22+
steps:
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- uses: ./.github/actions/setup-deno
26+
27+
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
28+
with:
29+
node-version: 22
30+
31+
- name: Install ICP-CLI
32+
run: npm install -g @icp-sdk/icp-cli@0.2.3 @icp-sdk/ic-wasm@0.9.10
33+
34+
- name: Setup Identity
35+
run: |
36+
mkdir -p ~/.local/share/icp-cli/identity/keys
37+
printf '%s' "$ICP_IDENTITY_DEPLOY" | base64 -d > ~/.local/share/icp-cli/identity/keys/deploy.pem
38+
sed -i 's/\\r\\n/\r\n/g' ~/.local/share/icp-cli/identity/keys/deploy.pem
39+
icp identity import deploy --from-pem ~/.local/share/icp-cli/identity/keys/deploy.pem --storage plaintext
40+
icp identity default deploy
41+
echo "deploy identity: $(icp identity principal)"
42+
env:
43+
ICP_IDENTITY_DEPLOY: ${{ secrets.ICP_IDENTITY_DEPLOY }}
44+
45+
- name: Deploy to Mainnet
46+
run: icp deploy docs -e ic
47+
48+
- name: Get URL
49+
id: get-url
50+
run: |
51+
URL="https://$(jq -r '.docs' "$GITHUB_WORKSPACE/.icp/data/mappings/ic.ids.json").icp0.io"
52+
echo "url=$URL" >> $GITHUB_OUTPUT

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Build output
22
.dfx/
3+
.icp/cache/
34
.astro/
45
dist/
56
node_modules/

.icp/data/mappings/ic.ids.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"docs": "ixpgz-eiaaa-aaaap-qumoq-cai"
3+
}

icp.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
canisters:
2+
- name: docs
3+
recipe:
4+
type: "@dfinity/asset-canister@v2.1.0"
5+
configuration:
6+
dir: docs/dist
7+
version: asset-canister-404-support
8+
build:
9+
- deno task docs:build

0 commit comments

Comments
 (0)