Skip to content

main: organize imports #105

main: organize imports

main: organize imports #105

Workflow file for this run

# https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
name: Build & deploy
on:
push:
branches:
- main
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
env:
VITE_BASE: "/toys/"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
- name: Setup wasm-pack
uses: jetli/[email protected]
with:
version: "latest"
- uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Write rust version
run: rustc -vV | tee .rustversion
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src/slomojs/crate/target/
target
key:
${{ hashFiles('.rustversion') }}-cargo-${{
hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: yarn --immutable
- name: Build rust
run: yarn build:rust
- name: Build web
run: yarn build
- name: Check
run: yarn run check
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
path: dist/
name: github-pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
fetch-depth: 0
- name: Setup git
run: |
git config --local user.email "[email protected]"
git config --local user.name "alex"
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY"
- name: Clear current
run: |
git ls-files | xargs git rm
- name: Download
uses: actions/download-artifact@v3
with:
name: github-pages
- name: Commit & push changes
run: |
set -eux
git add -A
# perform the steps of a git commit, but add the source commit as an extra parent:
tree_ref="$(git write-tree)"
commit_ref="$(git commit-tree "$tree_ref" -p HEAD -p "$GITHUB_SHA" -m "[automated] publish from $GITHUB_SHA on $(date)")"
git update-ref refs/heads/gh-pages "$commit_ref"
git push