Skip to content

Commit

Permalink
try to get caching working
Browse files Browse the repository at this point in the history
  • Loading branch information
Roguelazer committed Dec 13, 2024
1 parent 6e984b0 commit a618c34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ This is a small GitHub action that runs the Heroku installer to set up the `hero

```yaml
- uses: instrumentl/setup-heroku@v1
with:
# Pass "latest" here to use whatever heroku has made the default; otherwise, you
# can pass a specific version (e.g., '9.5.1') which must exactly match a version
# string in the undocumented heroku-cli manifest
version: 'latest'
```
20 changes: 17 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ runs:
if ! command -v gpg; then sudo -n apt-get install --no-install-recommends gnupg2 ; fi
if ! command -v curl; then sudo -n apt-get install --no-install-recommends curl ; fi
if ! command -v jq; then sudo -n apt-get install --no-install-recommends jq ; fi
- name: "Install Heroku CLI"
- name: "Determine download url"
id: get_url
shell: bash
env:
version: ${{ inputs.version }}
Expand Down Expand Up @@ -49,11 +50,24 @@ runs:
echo >&2 "Could not find download for ${version} for ${machine}"
exit 1
fi
curl -o "$wd/heroku.tar.gz" -sq "$url"
- name: Cache CLI
id: cache-cli
uses: actions/cache@v4
with:
path: /tmp/heroku-${{ inputs.version }}.tar.gz
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.get_url.outputs.url }}
- name: "Download CLI"
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -o "/tmp/heroku-${{ inputs.version }}.tar.gz" -sq "${{ steps.get_url.outputs.url }}"
- name: "Install Heroku CLI"
shell: bash
run: |
set -euo pipefail
sudo -n rm -rf /usr/local/lib/heroku
sudo -n mkdir -p /usr/local/lib/heroku
sudo -n tar -C /usr/local/lib -xpzf "$wd/heroku.tar.gz"
sudo -n tar -C /usr/local/lib -xpzf "/tmp/heroku-${{ inputs.version }}.tar.gz"
sudo -n rm -f /usr/local/bin/heroku
sudo -n ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
Expand Down

0 comments on commit a618c34

Please sign in to comment.