Skip to content

Continuous deployment #221

Continuous deployment

Continuous deployment #221

name: Continuous deployment
on:
# Create a stable release when tagging a version.
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# Create a canary release after CI completes. TODO: change this to only happen when CI passes.
workflow_run:
branches: [main]
workflows: [Continuous integration]
types: [completed]
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- uses: jetli/[email protected]
- uses: jetli/[email protected]
- uses: actions/checkout@v4
# The checkout above doesn't fetch tags, so we need to do it manually. The
# below command does this when a tag is pushed.
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth 1 origin +${{ github.ref }}:${{ github.ref }}
- run: git describe --always
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "deploy"
# Build the stable release and update the stable link.
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: cd axiom-profiler-GUI && trunk build --release --public-url /${{ github.event.repository.name }}/
- uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./axiom-profiler-GUI/dist
keep_files: true
# Also update the versioned link.
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: cd axiom-profiler-GUI && trunk build --release --public-url /${{ github.event.repository.name }}/${{ github.ref_name }}/
- uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./axiom-profiler-GUI/dist
destination_dir: ${{ github.ref_name }}
keep_files: true
# Build the canary release and update the canary link.
- if: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) }}
run: cd axiom-profiler-GUI && trunk build --release --public-url /${{ github.event.repository.name }}/canary/
- uses: peaceiris/actions-gh-pages@v3
if: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./axiom-profiler-GUI/dist
destination_dir: canary
keep_files: true