-
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.
This change implements two workflows that together implement the release process. The first workflow is manually triggered, takes a human-specified semver version string, and creates an automated commit that updates the version string in the required places, and then tags the new commit. The second workflow is triggered on release semver tags, and performs the build and creates the release. Tested: no - these workflows are hard to test manually, and will likely require trial+error on Github itself. Bug: linear/CUS-332
- Loading branch information
1 parent
06c6c42
commit bc03e17
Showing
7 changed files
with
119 additions
and
0 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
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,23 @@ | ||
name: "release" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
type: string | ||
description: Version of engflow_auth to release | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: release | ||
run: | | ||
infra/release.sh "${{ github.events.inputs.version }}" | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} |
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
Empty file.
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,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset -o pipefail -o errexit | ||
[[ "${SCRIPT_DEBUG:-"off"}" == "on" ]] && set -o xtrace | ||
|
||
if [[ "$#" -ne 1 ]]; then | ||
echo "Want 1 argument; got $# arguments" | ||
exit 1 | ||
fi | ||
|
||
readonly RELEASE_VERSION="$1" | ||
readonly GH_CLI_URL='https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.tar.gz' | ||
readonly GH_CLI_EXPECTED_SHA256='3ea6ed8b2585f406a064cecd7e1501e58f56c8e7ca764ae1f3483d1b8ed68826' | ||
|
||
# Check that supplied version string follows semver | ||
grep '[0-9]\+\.[0-9]\+\.[0-9]\+' <<<${RELEASE_VERSION} || { | ||
echo "Supplied version string '${RELEASE_VERSION}' does not follow semver; exiting" | ||
exit 1 | ||
} | ||
|
||
function cleanup { | ||
rm -rf "${GH_CLI_DIR}" | ||
} | ||
|
||
# Download and verify Github CLI | ||
# TODO(CUS-353): Remove this after installing Github CLI in the self-hosted | ||
# environment (run via Docker?) | ||
readonly GH_CLI_DIR="$(mktemp -d -t 'gh_cli_XXXXXXXX')" | ||
curl --location "${GH_CLI_URL}" \ | ||
| tee >(sha256sum - > "${GH_CLI_DIR}/archive_checksum.txt") \ | ||
| tar \ | ||
-C "${GH_CLI_DIR}" \ | ||
--strip-components 1 \ | ||
-xzvf \ | ||
- | ||
trap 'cleanup' EXIT | ||
readonly GH_CLI="${GH_CLI_DIR}/bin/gh" | ||
readonly GH_CLI_ACTUAL_SHA256="$(cat ${GH_CLI_DIR}/archive_checksum.txt | awk '{ print $1 }')" | ||
if [[ "${GH_CLI_ACTUAL_SHA256}" != "${GH_CLI_EXPECTED_SHA256}" ]]; then | ||
echo "SHA256 for Github CLI tarball ${GH_CLI_ACTUAL_SHA256} doesn't match expected value ${GH_CLI_ACTUAL_SHA256}; exiting" | ||
exit 1 | ||
fi | ||
|
||
# Check that the current commit is on either `main` or a release branch | ||
readonly EXPECTED_RELEASE_BRANCH="$(sed 's|\([0-9]\+\.[0-9]\+\)\.[0-9]\+|release/v\1|' <<<${RELEASE_VERSION})" | ||
git branch \ | ||
--contains "$(git rev-parse HEAD)" \ | ||
| grep "main|${EXPECTED_RELEASE_BRANCH}" \ | ||
|| { | ||
echo "Commit $(git rev-parse HEAD) is not on main or release branch ${EXPECTED_RELEASE_BRANCH}; exiting" | ||
exit 1 | ||
} | ||
|
||
# Add a tag | ||
git tag \ | ||
--annotate \ | ||
"v${RELEASE_VERSION}" \ | ||
--message "Release v${RELEASE_VERSION}" | ||
git push \ | ||
--follow-tags | ||
echo "Pushed new release tag: v${RELEASE_VERSION} at commit $(git rev-parse HEAD)" | ||
|
||
# Build release artifacts | ||
bazel build \ | ||
--config=release \ | ||
-- \ | ||
//:release_artifacts | ||
|
||
# Create release | ||
${GH_CLI} release create \ | ||
"v${RELEASE_VERSION}" \ | ||
--generate-notes \ | ||
"$(realpath bazel-out/k8-fastbuild-ST-*/bin/cmd/engflow_auth/engflow_auth_linux_x64)#engflow_auth (Linux, x64)" \ | ||
"$(realpath bazel-out/k8-fastbuild-ST-*/bin/cmd/engflow_auth/engflow_auth_macos_arm64)#engflow_auth (macOS, arm64)" \ | ||
"$(realpath bazel-out/k8-fastbuild-ST-*/bin/cmd/engflow_auth/engflow_auth_windows_x64)#engflow_auth (Windows, x64)" |
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,5 @@ | ||
"""Contains visibility constants to reduce duplication, increase BUILD file readability""" | ||
|
||
# Visibility used for artifacts that get released, which are defined by | ||
# filegroup(s) in the top-level BUILD file. | ||
RELEASE_ARTIFACT = ["//:__pkg__"] |