Always install the latest GitHub Actions Runner (#117)

This commit is contained in:
Nikolay Edigaryev 2024-01-17 17:56:53 +04:00 committed by GitHub
parent 4b3f94df8d
commit 19ccfde91c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 30 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
# Set shell options to enable fail-fast behavior
#
# * -e: fail the script when an error occurs or command fails
# * -u: fail the script when attempting to reference unset parameters
# * -o pipefail: by default an exit status of a pipeline is that of its
# last command, this fails the pipe early if an error in
# any of its commands occurs
#
set -euo pipefail
source ~/.zprofile
brew install jq
DOWNLOAD_URL=$(curl -sS 'https://api.github.com/repos/actions/runner/releases/latest' | jq --raw-output '.assets[] | select(.name | test("actions-runner-osx-arm64-[0-9.]+.tar.gz")) | .browser_download_url')
rm -rf actions-runner && mkdir actions-runner && cd actions-runner
wget -O - "${DOWNLOAD_URL}" | tar xz

View File

@ -11,10 +11,6 @@ variable "macos_version" {
type = string
}
variable "gha_version" {
type = string
}
source "tart-cli" "tart" {
vm_base_name = "ghcr.io/cirruslabs/macos-${var.macos_version}-vanilla:latest"
vm_name = "${var.macos_version}-base"
@ -53,15 +49,6 @@ build {
]
}
provisioner "shell" {
inline = [
"cd $HOME",
"mkdir actions-runner && cd actions-runner",
"curl -O -L https://github.com/actions/runner/releases/download/v${var.gha_version}/actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"tar xzf ./actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"rm actions-runner-osx-arm64-${var.gha_version}.tar.gz",
]
}
provisioner "shell" {
inline = [
"/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"",
@ -76,6 +63,12 @@ build {
"git lfs install",
]
}
// Install the GitHub Actions runner
provisioner "shell" {
script = "scripts/install-actions-runner.sh"
}
provisioner "shell" {
inline = [
"source ~/.zprofile",

View File

@ -15,10 +15,6 @@ variable "xcode_version" {
type = string
}
variable "gha_version" {
type = string
}
variable "android_sdk_tools_version" {
type = string
default = "9477386" # https://developer.android.com/studio/#command-tools
@ -39,18 +35,6 @@ source "tart-cli" "tart" {
build {
sources = ["source.tart-cli.tart"]
// re-install the actions runner
provisioner "shell" {
inline = [
"cd $HOME",
"rm -rf actions-runner",
"mkdir actions-runner && cd actions-runner",
"curl -O -L https://github.com/actions/runner/releases/download/v${var.gha_version}/actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"tar xzf ./actions-runner-osx-arm64-${var.gha_version}.tar.gz",
"rm actions-runner-osx-arm64-${var.gha_version}.tar.gz",
]
}
provisioner "shell" {
inline = [
"source ~/.zprofile",
@ -62,6 +46,11 @@ build {
]
}
// Re-install the GitHub Actions runner
provisioner "shell" {
script = "scripts/install-actions-runner.sh"
}
provisioner "shell" {
inline = [
"source ~/.zprofile",

View File

@ -1,3 +1,2 @@
macos_version = "sonoma"
gha_version = "2.312.0"
xcode_version = "15.2"