From 72578456c386472a5bbdb722e1abdc0b258ce8aa Mon Sep 17 00:00:00 2001 From: umarcor Date: Sun, 17 Oct 2021 02:23:42 +0200 Subject: [PATCH] ci: delay publishing to GitHub Pages until job PublishToGitHubPages --- .github/workflows/Pipeline.yml | 70 +++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 85debac5..51a5b8ba 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -7,6 +7,7 @@ defaults: shell: bash jobs: + UnitTesting: name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }} runs-on: ubuntu-latest @@ -107,7 +108,7 @@ jobs: retention-days: 1 StaticTypeCheck: - name: 📈 Check Static Typing using Python 3.10 + name: 👀 Check Static Typing using Python 3.10 runs-on: ubuntu-latest env: @@ -333,7 +334,7 @@ jobs: python3 example.py BuildTheDocs: - name: 📓 Run BuildTheDocs and publish to GH-Pages + name: 📓 Run BuildTheDocs runs-on: ubuntu-latest needs: - VerifyDocs @@ -354,10 +355,10 @@ jobs: RUN apk add -U --no-cache graphviz EOF - - name: 🛳️ Build documentation using container edaa/doc and publish to GitHub Pages + - name: 🛳️ Build documentation using container edaa/doc uses: buildthedocs/btd@v0 with: - token: ${{ github.token }} + skip-deploy: true - name: 📤 Upload 'documentation' artifacts uses: actions/upload-artifact@master @@ -366,27 +367,76 @@ jobs: path: doc/_build/html retention-days: 7 - ArtifactCleanUp: - name: 🗑️ Artifact Cleanup + PublishToGitHubPages: + name: 📚 Publish to GH-Pages runs-on: ubuntu-latest - needs: + - BuildTheDocs - Coverage - StaticTypeCheck + + env: + DOC: ${{ needs.BuildTheDocs.outputs.artifact }} + COVERAGE: ${{ needs.Coverage.outputs.artifact }} + TYPING: ${{ needs.StaticTypeCheck.outputs.artifact }} + outputs: + artifact: ${{ env.ARTIFACT }} + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: 📥 Download artifacts '${{ env.DOC }}' from 'StaticTypeCheck' job + uses: actions/download-artifact@v2 + with: + name: ${{ env.DOC }} + path: public + + - name: 📥 Download artifacts '${{ env.COVERAGE }}' from 'Coverage' job + uses: actions/download-artifact@v2 + with: + name: ${{ env.COVERAGE }} + path: public/coverage + + - name: 📥 Download artifacts '${{ env.TYPING }}' from 'StaticTypeCheck' job + uses: actions/download-artifact@v2 + with: + name: ${{ env.TYPING }} + path: public/typing + + - name: '📓 Publish site to GitHub Pages' + if: github.event_name != 'pull_request' + run: | + cd public + touch .nojekyll + git init + cp ../.git/config ./.git/config + git add . + git config --local user.email "BuildTheDocs@GitHubActions" + git config --local user.name "GitHub Actions" + git commit -a -m "update ${{ github.sha }}" + git push -u origin +HEAD:gh-pages + + ArtifactCleanUp: + name: 🗑️ Artifact Cleanup + runs-on: ubuntu-latest + needs: - Package - PublishOnPyPI + - PublishToGitHubPages env: COVERAGE: ${{ needs.Coverage.outputs.artifact }} TYPING: ${{ needs.StaticTypeCheck.outputs.artifact }} PACKAGE: ${{ needs.Package.outputs.artifact }} + DOC: ${{ needs.BuildTheDocs.outputs.artifact }} steps: - name: 🗑️ Delete all Artifacts uses: geekyeggo/delete-artifact@v1 with: name: | + ${{ env.COVERAGE }} + ${{ env.TYPING }} ${{ env.PACKAGE }} - -# ${{ env.COVERAGE }} -# ${{ env.TYPING }} + ${{ env.DOC }}