-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrade all CI workflows Signed-off-by: Alex Goodman <[email protected]> * add release docs Signed-off-by: Alex Goodman <[email protected]> * correct use of ci-release target in release workflow Signed-off-by: Alex Goodman <[email protected]> --------- Signed-off-by: Alex Goodman <[email protected]>
- Loading branch information
Showing
8 changed files
with
264 additions
and
158 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,77 @@ | ||
name: "Bootstrap" | ||
|
||
description: "Bootstrap all tools and dependencies" | ||
inputs: | ||
go-version: | ||
description: "Go version to install" | ||
required: true | ||
default: "1.21.x" | ||
use-go-cache: | ||
description: "Restore go cache" | ||
required: true | ||
default: "true" | ||
cache-key-prefix: | ||
description: "Prefix all cache keys with this value" | ||
required: true | ||
default: "831180ac25" | ||
build-cache-key-prefix: | ||
description: "Prefix build cache key with this value" | ||
required: true | ||
default: "f8b6d31dea" | ||
bootstrap-apt-packages: | ||
description: "Space delimited list of tools to install via apt" | ||
default: "" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe #v4.1.0 | ||
with: | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: Restore tool cache | ||
id: tool-cache | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 | ||
with: | ||
path: ${{ github.workspace }}/.tmp | ||
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-tool-${{ hashFiles('Makefile') }} | ||
|
||
# note: we need to keep restoring the go mod cache before bootstrapping tools since `go install` is used in | ||
# some installations of project tools. | ||
- name: Restore go module cache | ||
id: go-mod-cache | ||
if: inputs.use-go-cache == 'true' | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ inputs.cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}- | ||
- name: (cache-miss) Bootstrap project tools | ||
shell: bash | ||
if: steps.tool-cache.outputs.cache-hit != 'true' | ||
run: make bootstrap-tools | ||
|
||
- name: Restore go build cache | ||
id: go-cache | ||
if: inputs.use-go-cache == 'true' | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
key: ${{ inputs.cache-key-prefix }}-${{ inputs.build-cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ inputs.cache-key-prefix }}-${{ inputs.build-cache-key-prefix }}-${{ runner.os }}-go-${{ inputs.go-version }}- | ||
- name: (cache-miss) Bootstrap go dependencies | ||
shell: bash | ||
if: steps.go-mod-cache.outputs.cache-hit != 'true' && inputs.use-go-cache == 'true' | ||
run: make bootstrap-go | ||
|
||
- name: Install apt packages | ||
if: inputs.bootstrap-apt-packages != '' | ||
shell: bash | ||
run: | | ||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y ${{ inputs.bootstrap-apt-packages }} |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
red=$(tput setaf 1) | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
|
||
# assert we are running in CI (or die!) | ||
if [[ -z "$CI" ]]; then | ||
echo "${bold}${red}This step should ONLY be run in CI. Exiting...${normal}" | ||
exit 1 | ||
fi |
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,50 @@ | ||
#!/usr/bin/env bash | ||
set -eu | ||
|
||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
|
||
if ! [ -x "$(command -v gh)" ]; then | ||
echo "The GitHub CLI could not be found. To continue follow the instructions at https://github.com/cli/cli#installation" | ||
exit 1 | ||
fi | ||
|
||
gh auth status | ||
|
||
# we need all of the git state to determine the next version. Since tagging is done by | ||
# the release pipeline it is possible to not have all of the tags from previous releases. | ||
git fetch --tags | ||
|
||
# populates the CHANGELOG.md and VERSION files | ||
echo "${bold}Generating changelog...${normal}" | ||
make changelog 2> /dev/null | ||
|
||
NEXT_VERSION=$(cat VERSION) | ||
|
||
if [[ "$NEXT_VERSION" == "" || "${NEXT_VERSION}" == "(Unreleased)" ]]; then | ||
echo "Could not determine the next version to release. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
while true; do | ||
read -p "${bold}Do you want to trigger a release for version '${NEXT_VERSION}'?${normal} [y/n] " yn | ||
case $yn in | ||
[Yy]* ) echo; break;; | ||
[Nn]* ) echo; echo "Cancelling release..."; exit;; | ||
* ) echo "Please answer yes or no.";; | ||
esac | ||
done | ||
|
||
echo "${bold}Kicking off release for ${NEXT_VERSION}${normal}..." | ||
echo | ||
gh workflow run release.yaml -f version=${NEXT_VERSION} | ||
|
||
echo | ||
echo "${bold}Waiting for release to start...${normal}" | ||
sleep 10 | ||
|
||
set +e | ||
|
||
echo "${bold}Head to the release workflow to monitor the release:${normal} $(gh run list --workflow=release.yaml --limit=1 --json url --jq '.[].url')" | ||
id=$(gh run list --workflow=release.yaml --limit=1 --json databaseId --jq '.[].databaseId') | ||
gh run watch $id --exit-status || (echo ; echo "${bold}Logs of failed step:${normal}" && GH_PAGER="" gh run view $id --log-failed) |
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
Oops, something went wrong.