Merge pull request #36 from Hasnep/add-manual-ci-trigger #49
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: Build and deploy | |
on: | |
# Run when manually triggered | |
workflow_dispatch: | |
# Run on each PR | |
pull_request: | |
# Run when a new commit is pushed to the main branch | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Cache Nix environment | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Use Nix dev shell for subsequent steps | |
uses: rrbutani/use-nix-shell-action@v1 | |
with: | |
extraNixOptions: --accept-flake-config | |
- name: Run pre-commit | |
run: pre-commit run --all-files | |
env: | |
# Prevent this action failing when running on the main branch | |
SKIP: no-commit-to-branch | |
- name: Download data | |
run: just download | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: just build | |
- name: Deploy to Netlify | |
uses: jsmrcaga/action-netlify-deploy@v2.0.0 | |
with: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_DEPLOY_TO_PROD: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
build_directory: build | |
install_command: echo 'Skipping installing the dependencies' | |
build_command: echo 'Skipping building the web files' |