just a test commit for a pr #912
Workflow file for this run
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
on: [push, pull_request_target] | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request_target' | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: actions/checkout@v3 | |
if: github.event_name == 'push' | |
- run: rustup update | |
- id: get-rust-version | |
run: echo "rust_version=$(rustc --version)" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
.bin/ | |
target/ | |
~/.cargo/ | |
key: ${{ runner.os }}_${{ steps.get-rust-version.outputs.rust_version }}_cargo-run-bin_${{ hashFiles('rust-toolchain.toml', 'Cargo.toml', 'Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}_${{ steps.get-rust-version.outputs.rust_version }}_cargo-run-bin_ | |
${{ runner.os }}_${{ steps.get-rust-version.outputs.rust_version }}_ | |
${{ runner.os }}_ | |
- run: cargo install cargo-run-bin | |
- run: npm ci | |
- run: ./git_hooks/pre-commit | |
- run: cargo run --package builder | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: no_untracked | |
run: | | |
set -euxo pipefail | |
if [[ `git ls-files --exclude-standard --others` ]]; then | |
echo "untracked files detected" | |
exit 1 | |
fi | |
- name: no_modified | |
run: | | |
set -euxo pipefail | |
if ! git diff --exit-code; then | |
echo "modified files detected" | |
exit 1 | |
fi | |
- id: get_output_dir | |
run: echo "output_dir=$(cargo run -- print-output-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build_output_dir | |
path: ${{ steps.get_output_dir.outputs.output_dir }} | |
outputs: | |
output_dir: ${{ steps.get_output_dir.outputs.output_dir }} | |
deploy-preview: | |
if: github.event_name == 'pull_request_target' | |
needs: build | |
environment: pull_request_deployment | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build_output_dir | |
path: ${{ needs.build.outputs.output_dir }} | |
- id: deploy | |
run: | | |
npx vercel pull --yes --environment=preview --scope mobusoperandi --token=${{ secrets.VERCEL_TOKEN }} | |
URL=$(npx vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}) | |
echo "URL=$URL" >> $GITHUB_OUTPUT | |
- uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
Branch deployed for review at: | |
${{ steps.deploy.outputs.URL }} | |
deploy-production: | |
if: github.ref == 'refs/heads/master' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build_output_dir | |
path: ${{ needs.build.outputs.output_dir }} | |
- uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ${{ needs.build.outputs.output_dir }} |