From 55ed75bf69afad793ab9c47f125b5ffca003e10d Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Thu, 15 Aug 2024 16:23:36 -0700 Subject: [PATCH 1/2] Draft idea for building edition websites --- .github/workflows/build.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a25bc17b..2e1c35b5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - v* jobs: build-book: @@ -76,6 +77,7 @@ jobs: run: cd website && make - name: Deploy website index + if: github.ref == 'refs/heads/main' uses: JamesIves/github-pages-deploy-action@v4.6.1 with: folder: website @@ -95,6 +97,7 @@ jobs: # run: cd source && ninja python-book-pdf - name: Deploy Python book + if: github.ref == 'refs/heads/main' uses: JamesIves/github-pages-deploy-action@v4.6.1 with: folder: python-book @@ -113,6 +116,7 @@ jobs: # run: cd source && ninja python-book-pdf - name: Deploy R book + if: github.ref == 'refs/heads/main' uses: JamesIves/github-pages-deploy-action@v4.6.1 with: folder: r-book @@ -120,3 +124,22 @@ jobs: branch: main single-commit: true token: ${{ secrets.BOOK_UPLOAD_TOKEN }} + + # If we're building a set edition, such as v3, push all into + # same repo + + - name: Setup book edition for deployment + if: startsWith(github.ref, 'refs/heads/v') + run: | + cp -r r-book website + cp -r python-book website + + - name: Deploy book edition + if: startsWith(github.ref, 'refs/heads/v') + uses: JamesIves/github-pages-deploy-action@v4.6.1 + with: + folder: website + repository-name: "resampling-stats/${{ github.ref_name }}" + branch: main + single-commit: true + token: ${{ secrets.BOOK_UPLOAD_TOKEN }} From 9e8a795d77166a6ed18b32df8dbc290d2b5423cf Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Thu, 15 Aug 2024 16:32:00 -0700 Subject: [PATCH 2/2] Use one token per edition --- .github/workflows/build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e1c35b5..e3a49fd9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -137,9 +137,11 @@ jobs: - name: Deploy book edition if: startsWith(github.ref, 'refs/heads/v') uses: JamesIves/github-pages-deploy-action@v4.6.1 + env: + TOKEN_NAME: BOOK_UPLOAD_TOKEN_${{ github.ref_name }} with: folder: website repository-name: "resampling-stats/${{ github.ref_name }}" branch: main single-commit: true - token: ${{ secrets.BOOK_UPLOAD_TOKEN }} + token: ${{ secrets[env.TOKEN_NAME] }}