actions/{upload,download}-artifact@v4 #1090
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: | |
branches: [main] | |
pull_request: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check-and-build: | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v4 | |
with: | |
path: ./result | |
if-no-files-found: error | |
deploy-preview: | |
if: github.event_name == 'pull_request' | |
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@v4 | |
with: | |
name: artifact | |
path: .vercel/output/static | |
- id: deploy | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
run: nix --accept-flake-config run .#deploy-preview | |
- 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/main' | |
needs: check-and-build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: artifact |