Clone:
git clone https://github.com/JulienBreux/cloud-run-github-runner/
Create the secret:
Important
Change the values of GITHUB_SECRET_VALUE
.
See How to get a Github register token
gcloud secrets create GH_TOKEN --replication-policy="automatic"
echo -n "GITHUB_SECRET_VALUE" | gcloud secrets versions add GH_TOKEN --data-file=-
Permissions:
Note
Need to set the secretAccessor
to the right service account.
gcloud secrets add-iam-policy-binding GH_TOKEN \
--member="serviceAccount:[email protected]" \
--role="roles/secretmanager.secretAccessor"
Deploy:
Important
Change the values of GITHUB_USER_OR_ORGANIZATION
and REPOSITORY_NAME
.
gcloud alpha run worker-pools deploy cloud-run-github-runner \
--source=. \
--min=1 \
--set-env-vars GH_OWNER=GITHUB_USER_OR_ORGANIZATION,GH_REPOSITORY=REPOSITORY_NAME \
--set-secrets GH_TOKEN=GH_TOKEN:latest
Note
In this case cloud-run-github-runner
is the name of the Cloud Run Worker pool.
Clone:
git clone https://github.com/JulienBreux/cloud-run-github-runner/
Build:
cd cloud-run-github-runner/
docker build \
--build-arg TARGETOS=linux \
--build-arg TARGETARCH=amd64 \
--build-arg RUNNER_VERSION=2.292.0 \
--tag cloud-run-github-runner .
Deploy:
Important
Change the values of GITHUB_TOKEN
, GITHUB_USER_OR_ORGANIZATION
and REPOSITORY_NAME
.
docker run \
-e GH_TOKEN=GITHUB_TOKEN \
-e GH_OWNER=GITHUB_USER_OR_ORGANIZATION \
-e GH_REPOSITORY=REPOSITORY_NAME \
-d cloud-run-github-runner
Note
In this case cloud-run-github-runner
is the name of the Cloud Run Worker pool.
Very simple, go to "Add new self-hosted runner" in settings section of your repository. For example: https://github.com/JulienBreux/cloud-run-github-runner/settings/actions/runners/new
Copy the register token.
See CONTRIBUTING for more information.