Make separate build step in CI for drafts

This commit is contained in:
Gabriel Arazas 2023-04-24 11:07:14 +08:00
parent beb2efd291
commit 744b834491
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
3 changed files with 39 additions and 17 deletions

31
.github/workflows/build-drafts.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: "Build and deploy drafted versions to Netlify"
on:
push:
branches:
- drafts/*
- content/*
workflow_run:
workflows:
- "Update webring"
types:
- "completed"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Fetch all 'content/' branches
run: |
git fetch origin +refs/heads/content/*:refs/heads/content/*
- run: |
nix develop
make build-draft
netlify deploy --context branch-deploy

View File

@ -9,6 +9,9 @@ on:
- "Update webring" - "Update webring"
types: types:
- "completed" - "completed"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -22,20 +25,7 @@ jobs:
- name: Fetch all 'content/' branches - name: Fetch all 'content/' branches
run: | run: |
git fetch origin +refs/heads/content/*:refs/heads/content/* git fetch origin +refs/heads/content/*:refs/heads/content/*
- run: nix develop -c make build - run: |
- name: Deploy to Netlify nix develop
uses: nwtgck/actions-netlify@v2 make build
with: netlify deploy
publish-dir: ./public
netlify-config-path: ./netlify.toml
production-branch: master
production-deploy: ${{ github.ref_name == 'master' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: true
enable-commit-status: true
overwrites-pull-request-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

View File

@ -31,6 +31,7 @@ mkShell {
gnumake gnumake
tree-sitter tree-sitter
(tree-sitter.withPlugins (_: tree-sitter.allGrammars)) (tree-sitter.withPlugins (_: tree-sitter.allGrammars))
netlify-cli
# Formatters... # Formatters...
rufo # ...for Ruby. rufo # ...for Ruby.