forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (42 loc) · 1.51 KB
/
recreate-linux-runners.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Recreate Linux self-hosted runners on schedule
on:
workflow_dispatch:
schedule:
# Once each 24 hours, at 1 during the night
- cron: "0 1 * * *"
concurrency:
group: recreate-linux-runners
cancel-in-progress: true
jobs:
recreate:
if: github.repository == 'Homebrew/homebrew-core'
runs-on: ubuntu-latest
env:
# TODO agree on one label for all runners
RUNNER_LABEL: TODO
strategy:
matrix:
runner_name:
- linux-self-hosted-1
steps:
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Wait for idle runner
id: killable
uses: Homebrew/actions/wait-for-idle-runner@master
with:
runner_name: ${{ matrix.runner_name }}
github_token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
- name: Kill runner and create a new one
if: ${{ steps.killable.outputs.runner-found == 'true' && steps.killable.outputs.runner-idle == 'true' }}
uses: Homebrew/actions/create-gcloud-instance@master
with:
runner_name: ${{ matrix.runner_name }}
gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
gcp_service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
github_token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}