This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
forked from actions/runner
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: automatically bump the version number in rust-lang/gha-self-hosted
- Loading branch information
1 parent
251a3ef
commit bca51f2
Showing
2 changed files
with
52 additions
and
48 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,47 @@ | ||
#!/bin/bash | ||
# This script updates the version number in rust-lang/gha-self-hosted after a | ||
# release is made, removing the need for someone on the infrastructure team to | ||
# bump the version number manually. | ||
# | ||
# It's executed by .github/workflows/release.yml | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
repository_url="[email protected]:rust-lang/gha-self-hosted.git" | ||
version_file="images/ubuntu/files/gha-runner-version" | ||
|
||
git_name="rust-lang/gha-runner" | ||
git_email="[email protected]" | ||
|
||
# Load the deploy key on a temporary file. | ||
key="$(mktemp)" | ||
trap "rm ${key}" EXIT | ||
echo "${DEPLOY_KEY}" > "${key}" | ||
|
||
# Use the SSH key stored earlier for all git operations, and ignore ssh-agent. | ||
export GIT_SSH_COMMAND="ssh -i ${key}" | ||
unset SSH_AUTH_SOCK | ||
|
||
# Clone the repository | ||
clone="$(mktemp -d)" | ||
trap "rm -rf ${clone}" EXIT | ||
git clone "${repository_url}" "${clone}" | ||
|
||
# Update the version file | ||
version="$(cat releaseVersion)" | ||
if [[ "$(cat "${clone}/${version_file}")" = "${version}" ]]; then | ||
echo "nothing to update, exiting" | ||
else | ||
echo "${version}" > "${clone}/${version_file}" | ||
( | ||
cd "${clone}" | ||
git add . | ||
git \ | ||
-c commit.gpgsign=false \ | ||
-c "user.name=${git_name}" \ | ||
-c "user.email=${git_email}" \ | ||
commit -m "Bump the GitHub Actions runner to version ${version}" | ||
git push | ||
) | ||
fi |