From d53a7936c67571a4bec340f71b89432a73cd5cf7 Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Tue, 13 Aug 2024 21:17:10 +0200 Subject: [PATCH] Publish to Netlify --- .github/workflows/gh-pages.yml | 39 +++++++++++++++++++++++++++++++--- netlify.toml | 25 ---------------------- 2 files changed, 36 insertions(+), 28 deletions(-) delete mode 100644 netlify.toml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 0bb9f2da..dc6642d2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -5,7 +5,7 @@ on: push: workflow_dispatch: inputs: - perform_step: + publish_gh_pages: type: boolean description: 'Publish GH Page' default: false @@ -72,13 +72,46 @@ jobs: path: public retention-days: 7 - publish: + publish-to-github: runs-on: ubuntu-latest needs: pages - if: ${{ github.event.inputs.perform_step }} + if: ${{ github.event.inputs.publish_gh_pages }} steps: + - name: Download GitHub Pages Artifact + uses: actions/download-artifact@v4 + with: + name: github-pages + path: public + - name: Deploy Pages uses: actions/deploy-pages@v4 with: token: ${{ secrets.GITHUB_TOKEN }} + publish-to-netlify: + runs-on: ubuntu-latest + needs: pages + if: ${{ !github.event.inputs.publish_gh_pages }} + steps: + - name: Download GitHub Pages Artifact + uses: actions/download-artifact@v4 + with: + name: github-pages + path: public + + - name: Cache Netlify CLI + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-netlify-cli-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-netlify-cli + + - name: Deploy to Netlify + uses: South-Paw/action-netlify-cli@v2 + id: netlify + with: + # be sure to escape any double quotes with a backslash + args: 'deploy --json --dir ./public --message \"draft [${{ github.sha }}]\"' + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index 1a9005be..00000000 --- a/netlify.toml +++ /dev/null @@ -1,25 +0,0 @@ -[Settings] -# Added automatically by the Netlify CLI. It has no effect during normal -# Git-backed deploys. -ID = "htmlSanityCheck" - -# Settings in the [build] context are global and are applied to all contexts -# unless otherwise overridden by more specific contexts. -[build] - # Directory to change to before starting a build. - # This is where we will look for Gemfile etc - base = "src/docs/website" - - # Directory (relative to root of your repo) that contains the deploy-ready - # HTML files and assets generated by the build. - publish = "src/docs/website/_site" - - # build command: - # the order or commands is important: - # 1.) jekyll needs to build FIRST, as it creates the _site directory - # 2.) second, gradlew needs to build the adoc files. - # We use "generateDocs" here to avoid Excel-related warnings - # 2b.) gradlew shall/can run the HtmlSanityChecker or other tests - # 3.) the gradle-generated files are copied over to the _site directory - - command="jekyll build && cd ../../.. && ./gradlew generateDocs && cp -r ./build/docs/html5/ src/docs/website/_site/documentation "