-
Notifications
You must be signed in to change notification settings - Fork 16
171 lines (144 loc) · 4.54 KB
/
deploy-sdk.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Deploy SDK
on:
# Run automatically on tag push
push:
tags:
- sdk/*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'deploy-sdk'
cancel-in-progress: false
env:
NODE_VERSION: 18.16.0
RUST_VERSION: 1.73
RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install rust
run: rustup default ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
packages/rust-bindings
deps/concordium-base/rust-src
deps/concordium-base/smart-contracts/contracts-common
- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
./node_modules
./docs/node_modules
./packages/*/node_modules
./examples/**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Cache GRPC
id: cache-grpc
uses: actions/cache@v3
with:
path: |
./packages/sdk/src/grpc-api
key: ${{ runner.os }}-grpc-${{ hashFiles('deps/concordium-base/concordium-grpc-api') }}
restore-keys: ${{ runner.os }}-grpc
- name: Get dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Build release
run: yarn build:all
- name: Generate typedoc documentation
run: yarn build:docs
- name: Store build-release
uses: actions/upload-artifact@v4
with:
name: build-release
path: |
packages/sdk/lib
packages/sdk/src
packages/sdk/package.json
packages/sdk/README.md
- name: Store typedoc
uses: actions/upload-artifact@v4
with:
name: typedoc-build
path: typedoc
upload-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
environment: deploy
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Extract tag name
id: get_tag
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/sdk/}"
- name: Test that tag version matches package.json version
run: test "${{ steps.get_tag.outputs.tag }}" = "$(jq -r ".version" packages/sdk/package.json)" || exit 1
- name: Get build-output
uses: actions/download-artifact@v4
with:
path: packages/sdk
name: build-release
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM
run: |
yarn config set npmAuthToken $NPM_AUTH_TOKEN
yarn workspace @concordium/web-sdk npm publish
env:
NPM_AUTH_TOKEN: '${{secrets.NPM_PUBLISH_TOKEN}}'
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: sdk/v${{ steps.get_tag.outputs.tag_name }}
name: SDK Release v${{ steps.get_tag.outputs.tag_name }}
draft: true
deploy-typedoc:
needs:
- upload-release
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get typedoc
uses: actions/download-artifact@v4
with:
path: typedoc
name: typedoc-build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload GH pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: './typedoc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2