From e831be17099c7c880cdd098302737406357bb5d0 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Tue, 2 May 2023 14:16:00 +0800 Subject: [PATCH] Update GitHub workflow for building drafts --- .github/workflows/build-drafts.yml | 30 ------------------------------ .github/workflows/build.yml | 8 +++++++- 2 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/build-drafts.yml diff --git a/.github/workflows/build-drafts.yml b/.github/workflows/build-drafts.yml deleted file mode 100644 index 1e19b0a..0000000 --- a/.github/workflows/build-drafts.yml +++ /dev/null @@ -1,30 +0,0 @@ -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/* - - name: Build and deploy site - run: | - nix develop --command bash -c "netlify deploy --build --context branch-deploy" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb3db73..925685b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - drafts/* - content/* workflow_run: workflows: @@ -25,6 +26,11 @@ jobs: - name: Fetch all 'content/' branches run: | git fetch origin +refs/heads/content/*:refs/heads/content/* - - name: Build and deploy site + - if: github.ref_name == 'master' + name: Build and deploy site run: | nix develop --command bash -c "netlify deploy --build --prod" + - if: starts_with('drafts/', github.ref_name) + name: Build and deploy draft versions of the site + run: | + nix develop --command bash -c "netlify deploy --build --context branch-deploy"