Skip to content

Sas48 event

Sas48 event #12

name: Preview Deployment from Fork
on:
pull_request_target:
types: [opened, synchronize, labeled, reopened]
permissions:
contents: read
statuses: write
pull-requests: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
# Only run this workflow if PR is from a fork
if: github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Nix
uses: cachix/install-nix-action@v20
- name: Set up nix cache
uses: DeterminateSystems/magic-nix-cache-action@v1
- name: Build
run: |
nix build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-results
path: ./result/public
deploy:
name: Deploy
runs-on: ubuntu-latest
# This workflow accesses secrets and checks out a PR, so only run if labelled
if: contains(github.event.pull_request.labels.*.name, 'preview')
needs: build
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-results
path: ./result/public
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: "./result/public"
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.pull_request.title }}
alias: deploy-preview-${{ github.event.number }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1