Skip to content

Instantly share code, notes, and snippets.

@TheJotob
Last active July 26, 2022 19:08
Show Gist options
  • Save TheJotob/5741b9e74a42aa956f9ebb188917a1d9 to your computer and use it in GitHub Desktop.
Save TheJotob/5741b9e74a42aa956f9ebb188917a1d9 to your computer and use it in GitHub Desktop.
Github Action to flush heroku build cache, when npm dependencies change
---
name: Flush Heroku Build Cache
on:
push:
branches:
- main
paths:
- yarn.lock
jobs:
flush-build-cache:
runs-on: ubuntu-latest
steps:
- name: Heroku Login
run: |
cat > ~/.netrc <<EOF
machine api.heroku.com
login $HEROKU_EMAIL
password $HEROKU_API_KEY
EOF
env:
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Install heroku:build plugin
run: heroku plugins:install heroku-builds
- name: Clear Heroku Build Cache
run: heroku builds:cache:purge --app your-app-name --confirm your-app-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment