Skip to content

Commit

Permalink
Merge branch 'main' into build-platform-image
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Jan 27, 2023
2 parents a494151 + a63d5ca commit c297005
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/configlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:

- name: Fetch configlet
uses: exercism/github-actions/configlet-ci@main
# GITHUB_TOKEN is not set when we run the fetch script, because we're in
# a composite action. Set GH_TOKEN so that `gh release download` can
# make authenticated requests (it fails otherwise).
env:
GH_TOKEN: ${{ github.token }}

- name: Run configlet lint
run: configlet lint
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docker-build-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ${{ secrets.DOCKER_BUILD_ARGS }}
platforms: ${{ inputs.platforms }}
provenance: false

- name: Push to Docker Hub
Expand Down
28 changes: 10 additions & 18 deletions configlet-ci/fetch-configlet
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
#!/bin/bash
set -euo pipefail
set -eo pipefail

curlopts=(
--silent
--show-error
--fail
--location
--retry 3
)
if [[ -z "${GH_TOKEN}" ]]; then
echo "The GH_TOKEN environment variable is not set" >&2
exit 1
fi

get_download_url() {
# Returns the download URL of the latest configlet Linux release from the GitHub API
local api_url='https://api.github.com/repos/exercism/configlet/releases/latest'
local asset_name='configlet-linux-64bit.tgz'
curl "${curlopts[@]}" --header "Accept: application/vnd.github.v3+json" "${api_url}" |
jq --arg name "${asset_name}" -r '.assets[] | select(.name==$name).browser_download_url'
}

download_url="$(get_download_url)"
curl "${curlopts[@]}" "${download_url}" | tar xz -C bin/
name='configlet.tar.gz'
gh -R exercism/configlet release download --output "${name}" \
--pattern 'configlet_*_linux_x86-64.tar.gz'
tar xzf "${name}" -C bin/
rm "${name}"

0 comments on commit c297005

Please sign in to comment.