Skip to content

Commit

Permalink
chore: add separate workflow for cache invalidation (#2937)
Browse files Browse the repository at this point in the history
* chore: move cache invalidation job to separate workflow file

* chore: add reference to cdn invalidation in promote workflows
  • Loading branch information
k80bowman authored Jul 17, 2024
1 parent 4da724b commit 0fba05d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/cache-invalidation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Invalidate CDN cache

on:
[workflow_call, workflow_dispatch]

jobs:
invalidate-cdn-cache:
needs: [ promote ]
runs-on: ubuntu-latest
env:
CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get update
sudo apt-get install -y awscli
aws configure set preview.cloudfront true
- run: ./scripts/postrelease/invalidate_cdn_cache
16 changes: 3 additions & 13 deletions .github/workflows/promote-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,10 @@ jobs:

## POST release jobs
invalidate-cdn-cache:
name: Invalidate CDN cache
needs: [ promote ]
runs-on: ubuntu-latest
env:
CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get update
sudo apt-get install -y awscli
aws configure set preview.cloudfront true
- run: ./scripts/postrelease/invalidate_cdn_cache
uses: ./.github/workflows/cache-invalidation.yml
secrets: inherit

release-homebrew:
needs: [ invalidate-cdn-cache ]
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/promote-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ jobs:
run: |
SHA=$(npm view heroku@${{ inputs.version }} --json | jq -r '.gitHead[0:7]')
yarn oclif promote --win --root="./packages/cli" --sha="$SHA" --indexes --version=${{ inputs.version }} --channel=${{ fromJSON(inputs.isStableRelease) && 'stable' || env.prerelease-channel }}
shell: bash
shell: bash

invalidate-cdn-cache:
name: Invalidate CDN cache
needs: [ promote ]
uses: ./.github/workflows/cache-invalidation.yml
secrets: inherit

0 comments on commit 0fba05d

Please sign in to comment.