-
Notifications
You must be signed in to change notification settings - Fork 11
107 lines (92 loc) · 3.94 KB
/
cd.yaml
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
name: CD
on: [push]
#on:
# push:
# branches: ["main"]
# workflow_dispatch:
concurrency:
group: "publish"
cancel-in-progress: true
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
strategy:
matrix:
pkg:
- package-name: "client-wasm"
- package-name: "client-vms"
- package-name: "client-react-hooks"
steps:
- name: Generate nillion repo app token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.NILLION_GITHUB_ACTIONS_PUBLIC_APP_ID }}
owner: NillionNetwork
private-key: ${{ secrets.NILLION_GITHUB_ACTIONS_PUBLIC_APP_PRIVATE_KEY }}
repositories: nillion
- uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
submodules: 'recursive'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.24"
- name: Set up Python
run: uv python install
- name: Check version
id: check-version
run: >-
cd scripts/version_checker && uv run ./version_checker.py ../../${{ matrix.pkg.package-name }}
- name: Install rustup
if: matrix.pkg.package-name == 'client-wasm' && steps.check-version.outputs.local_version_is_higher == 'true'
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-07-01
target: wasm32-unknown-unknown
- uses: jdx/mise-action@v2
if: matrix.pkg.package-name == 'client-wasm' && steps.check-version.outputs.local_version_is_higher == 'true'
- uses: actions/setup-node@v4
if: steps.check-version.outputs.local_version_is_higher == 'true'
with:
node-version: "23.0"
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v4
if: steps.check-version.outputs.local_version_is_higher == 'true'
- run: pnpm install
if: steps.check-version.outputs.local_version_is_higher == 'true'
- name: Build client-wasm
if: matrix.pkg.package-name == 'client-wasm' && steps.check-version.outputs.local_version_is_higher == 'true'
run: |
pnpm --filter "@nillion/client-wasm" build
- name: Build client-vms
if: matrix.pkg.package-name == 'client-vms' && steps.check-version.outputs.local_version_is_higher == 'true'
run: |
pnpm build:proto
pnpm --filter "@nillion/client-vms" build
- name: Build client-react-hooks
if: matrix.pkg.package-name == 'client-react-hooks' && steps.check-version.outputs.local_version_is_higher == 'true'
run: |
pnpm build:proto
pnpm --filter "@nillion/client-vms" build
pnpm --filter "@nillion/client-react-hooks" build
- env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: steps.check-version.outputs.local_version_is_higher == 'true'
run: pnpm --filter "@nillion/${{ matrix.pkg.package-name }}" publish --tag ${{ steps.check-version.outputs.tag }} --no-git-checks
- name: Create GH Release
id: create-release
if: steps.check-version.outputs.local_version_is_higher == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
[[ "${{ steps.check-version.outputs.tag }}" == "next" ]] && PRERELEASE="-p" || PRERELEASE=""
gh release create '${{ matrix.pkg.package-name }}-v${{ steps.check-version.outputs.local_version }}' --generate-notes $PRERELEASE --title "${{ matrix.pkg.package-name }}-v${{ steps.check-version.outputs.local_version }}"
# - name: Upload artifact to GH Release
# if: steps.check-version.outputs.local_version_is_higher == 'true'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: >-
# gh release upload '${{ matrix.pkg.package-name }}-v${{ steps.check-version.outputs.local_version }}' dist/${{ matrix.pkg.package-name }}/**