Skip to content

Commit

Permalink
Add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Oshawk committed May 16, 2024
1 parent 8aab6a9 commit 0d4bb05
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
push:
branches:
- version/*

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install trunk
uses: taiki-e/install-action@v2
with:
tool: trunk

- name: Build
run: trunk build --public-url . --release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build
path: dist
88 changes: 88 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deploy

on:
workflow_dispatch:

permissions:
contents: read
id-token: write
pages: write

jobs:
get-versions:
runs-on: ubuntu-latest

outputs:
versions: ${{ steps.versions.outputs.versions }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: pages
fetch-depth: 0

- name: Get versions
id: versions
run: echo "versions=$(git branch -r --format '%(refname:lstrip=3)' | sed -nr 's/version\/(.+)/\1/p' | jq -cRn '[inputs]')" >> "$GITHUB_OUTPUT"

get-artifacts:
needs:
- get-versions

runs-on: ubuntu-latest

strategy:
matrix:
version: ${{ fromJson(needs.get-versions.outputs.versions) }}

steps:
- name: Download artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yml
branch: ${{ format('version/{0}', matrix.version) }}
name: build
name_is_regexp: false
path: build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.version }}
path: build
retention-days: 1

deploy:
needs:
- get-artifacts

runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: pages

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Create home page
run: python3 deploy.py

- name: Setup pages
uses: actions/configure-pages@v5

- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: .

- name: Deploy pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 0d4bb05

Please sign in to comment.