Skip to content

Build, Release, Deploy #54

Build, Release, Deploy

Build, Release, Deploy #54

name: Build, Release, Deploy
on:
workflow_dispatch:
release:
types: [created] # Trigger when a new release is created
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build_release:
name: Build release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Binstall
uses: cargo-bins/cargo-binstall@main
- name: Set up Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown, wasm32-wasi
toolchain: nightly-x86_64-unknown-linux-gnu
components: rust-src, rustfmt
- name: Install cargo component v0.13.2
run: echo yes | cargo binstall cargo-component@0.13.2
- name: Run binstall just, wasm-tools
run: |
cargo binstall just --no-confirm
cargo binstall wasm-tools --no-confirm
- name: Build and Compose Wasm
run: |
just build-submodules
just compose
- name: Archive build
uses: actions/upload-artifact@v4
with:
name: wasm-artifact
path: dist/peerpiper_wallet_aggregate.wasm
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: dist/peerpiper_wallet_aggregate.wasm
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set VITE_BASE
run: |
echo "VITE_BASE=https://${GITHUB_REPOSITORY_OWNER,,}.github.io/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Set BASE_PATH
run: |
echo "BASE_PATH=/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: "./packages/demos/package-lock.json"
- name: Install dependencies
run: |
cd packages/demos
npm install
cd inner-app
npm install
- name: build
env:
BASE_PATH: ${{ env.BASE_PATH }}
VITE_BASE: ${{ env.VITE_BASE }}
run: |
cd packages/demos/inner-app
npm run build
cd ..
npm run build
# touch docs/.nojekyll
- name: Get version of inner-app
id: get_version
run: echo "VERSION=$(jq -r '.version' ./inner-app/package.json)" >> $GITHUB_ENV
# - name: Commit built dist
# run: |
# FOLDER_NAME="packages/demos/static/$VERSION"
# git config --global user.name 'github-actions[bot]'
# git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# git add -f $FOLDER_NAME
# git commit -m "Add dist build for version $VERSION"
# git push
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
# VERSION: ${{ env.VERSION }}
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
# this should match the `pages` option in your adapter-static options
path: "packages/demos/docs/"
deploy:
needs: build_release
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4