From a1f65a29a90fa7baa5bd614570bcba7c51e42c6a Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 28 Nov 2022 08:08:32 +0800 Subject: [PATCH] Build with Netlify Mainly because of `baseURL` issues, I cannot deploy this site properly with its assets. To fix it, I just have to properly set them and the easiest way to do so is to build it with Netlify. With this change, the webring post update will be in a separate workflow and done in a schedule. --- .github/workflows/build.yml | 30 ---------------------------- .github/workflows/update-webring.yml | 27 +++++++++++++++++++++++++ netlify.toml | 14 ++++++++----- 3 files changed, 36 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/update-webring.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 06bf452..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: "Build and deploy to Netlify" -on: - push: - branches: - - master -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v17 - with: - nix_path: nixpkgs=channel:nixpkgs-unstable - - run: nix develop -c make build - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 - 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 }} diff --git a/.github/workflows/update-webring.yml b/.github/workflows/update-webring.yml new file mode 100644 index 0000000..7106d26 --- /dev/null +++ b/.github/workflows/update-webring.yml @@ -0,0 +1,27 @@ +name: "Update webring post list" +on: + schedule: + # Every Sunday. + - cron: '0 0 * * 0' +env: + # GitHub bot + GIT_AUTHOR_NAME: "github-actions[bot]" + GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com" +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v18 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + keep-going = true + - run: nix develop -c make build-openring + - name: Update webring post list + run: | + git add . + git commit -m "Update webring post list as of $(date '+%F')" + git remote remove origin + git remote add origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git + git push --set-upstream origin master diff --git a/netlify.toml b/netlify.toml index 03a2586..e50cb76 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,15 +1,19 @@ [build] publish = "public/" -command = "make build" +command = "hugo --gc --minify" [context.production.environment] +HUGO_VERSION = "0.107.0" +HUGO_ENV = "production" +HUGO_ENABLEGITINFO = "true" HUGO_BASE_URL = "$DEPLOY_URL" [context.branch-deploy.environment] +HUGO_VERSION = "0.107.0" HUGO_BASE_URL = "$DEPLOY_PRIME_URL" -[context.deploy-preview] -command = "hugo --buildDrafts --buildFuture --buildExpired" - [context.deploy-preview.environment] -HUGO_BASE_URL = "$DEPLOY_PRIME_URL" +HUGO_VERSION = "0.107.0" + +[context.deploy-preview] +command = "hugo --buildDrafts --buildFuture --buildExpired --baseURL $DEPLOY_PRIME_URL"