Merge pull request #97 from NillionNetwork/chore/allow-paramter-react… #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
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: 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: | | |
npm pack --filter ./client-wasm | |
- 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 | |
npm pack --filter ./client-vms | |
- 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 | |
npm pack --filter ./client-react-hooks | |
- 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 }}' *.tgz |