-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from instrumentl/chore/heroku-9.5.1
chore: make it possible to install older versions of the heroku cli
- Loading branch information
Showing
4 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
pull_request: | ||
branches: ['*'] | ||
push: | ||
branches: ['main'] | ||
schedule: | ||
- cron: "18 18 * * 1" | ||
|
||
jobs: | ||
selfcheck: | ||
name: Test Action | ||
strategy: | ||
matrix: | ||
runner: [ubuntu-22.04, ubuntu-24.04, ubuntu-latest] | ||
version: [latest, 9.5.1, 10.0.0] | ||
runs-on: ${{ matrix.runner }} | ||
steps: | ||
# To use this repository's private action, | ||
# you must check out the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: ./ | ||
with: | ||
version: ${{matrix.version}} | ||
lint-with-pre-commit: | ||
runs-on: ubuntu-24.04 | ||
name: Lint with pre-commit | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: instrumentl/pre-commit-action@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: fix-byte-order-marker | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py | ||
rev: v1.7.4.20 | ||
hooks: | ||
- id: actionlint | ||
additional_dependencies: [ pyflakes>=3.0.1, shellcheck-py>=0.9.0.5 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,79 @@ | ||
name: 'Set up Heroku' | ||
description: 'Set up the Heroku CLI' | ||
inputs: | ||
version: | ||
description: "Version to install" | ||
required: true | ||
default: "latest" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Ensure GPG installed" | ||
- name: "Ensure dependencies are installed" | ||
shell: bash | ||
run: "if ! command -v gpg; then apt-get install --no-install-recommends gnupg2 ; fi" | ||
run: | | ||
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: "Determine download url" | ||
id: get_url | ||
shell: bash | ||
env: | ||
version: ${{ inputs.version }} | ||
run: | | ||
set -euo pipefail | ||
wd="$(mktemp -d)" | ||
on_exit() { | ||
status=$? | ||
[[ -n "$wd" ]] && rm -rf "$wd" | ||
exit $status | ||
} | ||
trap on_exit EXIT INT TERM | ||
raw_machine="$(uname -m)" | ||
if [[ "$raw_machine" = "aarch64" ]]; then | ||
machine="arm" | ||
elif [[ "$raw_machine" = "x86_64" ]]; then | ||
machine="x64" | ||
else | ||
echo >&2 "Unhandled machine type $raw_machine" | ||
exit 1 | ||
fi | ||
curl -fqs -o "$wd/versions.json" "https://cli-assets.heroku.com/versions/heroku-linux-${machine}-tar-gz.json" | ||
if [[ "$version" = "latest" ]]; then | ||
url="https://cli-assets.heroku.com/channels/stable/heroku-linux-${machine}.tar.gz" | ||
else | ||
url="$(jq -cr '.["'"${version}"'"]' < "$wd/versions.json")" | ||
fi | ||
if [[ -z "$url" ]] || [[ "$url" = "null" ]]; then | ||
echo >&2 "Could not find download for ${version} for ${machine}" | ||
exit 1 | ||
fi | ||
echo "url=${url}" >> "$GITHUB_OUTPUT" | ||
- 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" | ||
shell: bash | ||
if: steps.cache_cli.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: "curl -f https://cli-assets.heroku.com/install-ubuntu.sh | sh" | ||
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 "/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 | ||
/usr/local/lib/heroku/bin/node -v || sudo -n rm /usr/local/lib/heroku/bin/node | ||
- name: "Test that it runs correctly" | ||
run: "heroku version" | ||
shell: bash |