Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixify #268

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 21 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,42 @@ permissions:
contents: write
pull-requests: write

env:
RUST_BACKTRACE: 1

jobs:
build:
check-and-build:
permissions:
id-token: write

runs-on: ubuntu-latest
outputs:
output_dir: ${{ steps.get_output_dir.outputs.output_dir }}

steps:
- uses: actions/checkout@v3
- 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 }}_${{ hashFiles('rust-toolchain.toml', 'Cargo.toml', 'Cargo.lock') }}
restore-keys: |
${{ runner.os }}_${{ steps.get-rust-version.outputs.rust_version }}_
${{ runner.os }}_
- run: npm ci
- run: ./git_hooks/pre-commit
- run: cargo run build
- uses: numtide/clean-git-action@v2
- id: get_output_dir
run: echo "output_dir=$(cargo run -- print-output-dir)" >> $GITHUB_OUTPUT
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix --accept-flake-config flake check
- run: nix --accept-flake-config build
- uses: actions/upload-artifact@v3
with:
name: build_output_dir
path: ${{ steps.get_output_dir.outputs.output_dir }}
path: ./result
if-no-files-found: error

deploy-preview:
if: github.event_name == 'pull_request'
needs: build
needs: check-and-build
environment: pull_request_deployment
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/download-artifact@v3
with:
name: build_output_dir
path: ${{ needs.build.outputs.output_dir }}
name: artifact
path: .vercel/output/static
- 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
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: nix --accept-flake-config run .#deploy-preview
- uses: thollander/actions-comment-pull-request@v2
with:
message: |
Expand All @@ -68,14 +51,13 @@ jobs:

deploy-production:
if: github.ref == 'refs/heads/main'
needs: build
needs: check-and-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build_output_dir
path: ${{ needs.build.outputs.output_dir }}
path: deploy
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ${{ needs.build.outputs.output_dir }}
folder: deploy
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/.vercel
/node_modules
/target
/result
Loading
Loading