diff --git a/.github/workflows/build-drafts.yml b/.github/workflows/build-drafts.yml new file mode 100644 index 0000000..1c3331f --- /dev/null +++ b/.github/workflows/build-drafts.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f1757e..5188faf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,9 @@ on: - "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 @@ -22,20 +25,7 @@ jobs: - name: Fetch all 'content/' branches run: | git fetch origin +refs/heads/content/*:refs/heads/content/* - - run: nix develop -c make build - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v2 - with: - 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 }} + - run: | + nix develop + make build + netlify deploy diff --git a/shell.nix b/shell.nix index 0115c04..f37ad73 100644 --- a/shell.nix +++ b/shell.nix @@ -31,6 +31,7 @@ mkShell { gnumake tree-sitter (tree-sitter.withPlugins (_: tree-sitter.allGrammars)) + netlify-cli # Formatters... rufo # ...for Ruby.