close #12 #182
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: Rust | |
on: | |
pull_request: | |
# Trigger the workflow every time you push to the `main` branch | |
# Using a different branch name? Replace `main` with your branch’s name | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab on GitHub. | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: -D warnings | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
build: | |
environment: | |
name: cloudflare | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Trunk | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --force trunk | |
- name: Install cargo-make | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --force cargo-make | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-unknown-unknown | |
- uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Run install | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: install | |
dir: 'app' | |
- name: Build en | |
uses: actions-rs/cargo@v1 | |
with: | |
command: make | |
args: build-en | |
- name: Deploy en To Cloudflare | |
uses: cloudflare/wrangler-action@2.0.0 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: | | |
pages publish dist/en --project-name=viz-rs --commit-dirty=true | |
- name: Build zh-cn | |
uses: actions-rs/cargo@v1 | |
with: | |
command: make | |
args: build-zh-cn | |
- name: Deploy zh-cn To Cloudflare | |
uses: cloudflare/wrangler-action@2.0.0 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: | | |
pages publish dist/zh-cn --project-name=viz-rs-zh-cn --commit-dirty=true | |
- name: Deployment | |
uses: cloudflare/wrangler-action@2.0.0 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: | | |
pages deployment |