From cfe7c4eea6988f82c9d24c5dbf58ef39bf4beab4 Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Mon, 18 Mar 2024 21:03:08 +0100 Subject: [PATCH 1/3] chore: Build the docs on PRs With this commit CI will run also on PRs targeting main. Artifact publishing and deployment is disabled using an if condition Signed-off-by: Thorsten Hans --- .github/workflows/deploy.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 6caaf4e..525c057 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -60,11 +63,13 @@ jobs: --baseURL "https://${{ env.CANONICAL_DOMAIN }}/" - name: Upload artifact + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: path: ./public deploy: + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 8426943509e4112507ea7cc6dfc8ce030e713203 Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Mon, 18 Mar 2024 21:38:37 +0100 Subject: [PATCH 2/3] chore: Split main and pr workflows Signed-off-by: Thorsten Hans --- .github/workflows/deploy.yaml | 5 ---- .github/workflows/pr.yaml | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 525c057..6caaf4e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -4,9 +4,6 @@ on: push: branches: - main - pull_request: - branches: - - main # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: @@ -63,13 +60,11 @@ jobs: --baseURL "https://${{ env.CANONICAL_DOMAIN }}/" - name: Upload artifact - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: path: ./public deploy: - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..cda6253 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,46 @@ +name: Build only + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +env: + CANONICAL_DOMAIN: www.spinkube.dev + SPIN_OPERATOR_RELEASE: v0.1.0 + +jobs: + build: + runs-on: ubuntu-latest + env: + HUGO_VERSION: 0.123.0 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Hugo CLI + run: | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb + + - name: Install Node.js dependencies + run: npm install + + - name: Setup Go environment + uses: actions/setup-go@v5.0.0 + + - name: Generate CRD reference docs + run: ./generate.sh + working-directory: ./crd-reference + env: + SPIN_OPERATOR_RELEASE: ${{ env.SPIN_OPERATOR_RELEASE }} + + - name: Build + run: | + hugo \ + --gc \ + --minify \ + --baseURL "https://${{ env.CANONICAL_DOMAIN }}/" From 9c02fd9205558eaea8da8cc14640d18247d66515 Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Mon, 18 Mar 2024 21:58:15 +0100 Subject: [PATCH 3/3] chore: Remove baseURL for PR build and update action name Signed-off-by: Thorsten Hans --- .github/workflows/pr.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index cda6253..7466585 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,4 +1,4 @@ -name: Build only +name: Build on: pull_request: @@ -9,7 +9,6 @@ permissions: contents: read env: - CANONICAL_DOMAIN: www.spinkube.dev SPIN_OPERATOR_RELEASE: v0.1.0 jobs: @@ -42,5 +41,4 @@ jobs: run: | hugo \ --gc \ - --minify \ - --baseURL "https://${{ env.CANONICAL_DOMAIN }}/" + --minify