From d62e22161563724f7bba1fce4393731169525338 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Mon, 11 Nov 2024 13:06:50 -0600 Subject: [PATCH] ci: Build blog automatically on release --- .github/workflows/build.yml | 18 ++++++++++++------ .github/workflows/publish-release.yml | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb0172af..26edc9ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,9 @@ on: strict: type: boolean default: false + cache: + type: boolean + default: true permissions: contents: read @@ -119,6 +122,7 @@ jobs: - name: Restore Privacy Plugin Cache uses: actions/cache/restore@v4.0.2 id: privacy_cache_restore + if: inputs.cache with: key: privacy-cache-${{ inputs.repo }}-${{ hashfiles('.cache/plugin/privacy/**') }} path: | @@ -131,6 +135,7 @@ jobs: - name: Restore Social Plugin Cache uses: actions/cache/restore@v4.0.2 id: social_cache_restore + if: inputs.cache with: key: social-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ hashfiles('.cache/plugin/social/manifest.json') }} path: | @@ -143,6 +148,7 @@ jobs: - name: Restore Optimize Plugin Cache uses: actions/cache/restore@v4.0.2 id: optimize_cache_restore + if: inputs.cache with: key: optimize-cache-${{ inputs.repo }}-${{ hashfiles('.cache/plugin/optimize/manifest.json') }} path: | @@ -176,7 +182,7 @@ jobs: - name: Find Privacy Plugin Cache uses: actions/cache/restore@v4.0.2 - if: steps.privacy_cache_restore.outputs.cache-hit != 'true' + if: steps.privacy_cache_restore.outputs.cache-hit != 'true' && inputs.cache id: privacy_cache_test with: key: privacy-cache-privacyguides/privacyguides.org-${{ hashfiles('.cache/plugin/privacy/**') }} @@ -186,7 +192,7 @@ jobs: - name: Find Social Plugin Cache uses: actions/cache/restore@v4.0.2 - if: steps.social_cache_restore.outputs.cache-hit != 'true' + if: steps.social_cache_restore.outputs.cache-hit != 'true' && inputs.cache id: social_cache_test with: key: social-cache-privacyguides/privacyguides.org-${{ inputs.lang }}-${{ hashfiles('.cache/plugin/social/manifest.json') }} @@ -197,7 +203,7 @@ jobs: - name: Find Optimize Plugin Cache uses: actions/cache/restore@v4.0.2 - if: steps.optimize_cache_restore.outputs.cache-hit != 'true' + if: steps.optimize_cache_restore.outputs.cache-hit != 'true' && inputs.cache id: optimize_cache_test with: key: optimize-cache-privacyguides/privacyguides.org-${{ hashfiles('.cache/plugin/optimize/manifest.json') }} @@ -207,14 +213,14 @@ jobs: - name: Save Privacy Plugin Cache uses: actions/cache/save@v4.0.2 - if: steps.privacy_cache_test.outputs.cache-hit != 'true' + if: steps.privacy_cache_test.outputs.cache-hit != 'true' && inputs.cache with: key: privacy-cache-${{ inputs.repo }}-${{ hashfiles('.cache/plugin/privacy/**') }} path: .cache/plugin/privacy - name: Save Social Plugin Cache uses: actions/cache/save@v4.0.2 - if: steps.social_cache_test.outputs.cache-hit != 'true' + if: steps.social_cache_test.outputs.cache-hit != 'true' && inputs.cache with: key: social-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ hashfiles('.cache/plugin/social/manifest.json') }} path: | @@ -223,7 +229,7 @@ jobs: - name: Save Optimize Plugin Cache uses: actions/cache/save@v4.0.2 - if: steps.optimize_cache_test.outputs.cache-hit != 'true' + if: steps.optimize_cache_test.outputs.cache-hit != 'true' && inputs.cache with: key: optimize-cache-${{ inputs.repo }}-${{ hashfiles('.cache/plugin/optimize/manifest.json') }} path: .cache/plugin/optimize diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 89e4d1e2..c04d40c0 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -62,6 +62,17 @@ jobs: lang: ${{ matrix.lang }} context: production continue-on-error: false + cache: false + + build_blog: + needs: submodule + permissions: + contents: read + uses: ./.github/workflows/build-blog.yml + with: + repo: ${{ github.repository }} + ref: ${{ github.ref }} + continue-on-error: false release: name: Create release notes @@ -84,7 +95,7 @@ jobs: makeLatest: true deploy: - needs: build + needs: [build, build_blog] uses: privacyguides/webserver/.github/workflows/deploy-all.yml@main secrets: NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} @@ -101,5 +112,5 @@ jobs: cleanup: if: ${{ always() }} - needs: build + needs: [build, build_blog] uses: privacyguides/.github/.github/workflows/cleanup.yml@main