在歌曲載入文字中包含標題 #6
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/deploy.yml' | |
- 'packages.json' | |
- 'package-lock.json' | |
- 'src/**' | |
- 'Cargo.lock' | |
- 'Cargo.toml' | |
workflow_dispatch: | |
inputs: | |
skip_check: | |
type: boolean | |
default: false | |
description: 'Skip the check step' | |
required: false | |
jobs: | |
build-and-deploy: | |
if: github.repository == 'igncp/writing-trainer' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Install 🚧 | |
run: | | |
touch ./is-ci | |
nix develop path:$(pwd) -c rustup install stable | |
nix develop path:$(pwd) -c cargo build --release # This speeds up the next steps | |
nix develop path:$(pwd) -c bun install | |
- name: Check 🔧 | |
run: | | |
cp .env.example .env | |
nix develop path:$(pwd) -c bash scripts/check.sh | |
env: | |
SKIP_CHECK: ${{ github.event.inputs.skip_check }} | |
- name: Build and publish docker image | |
run: | | |
cp .env.example .env | |
nix develop path:$(pwd) -c bash -c scripts/ci/build_docker.sh |