Skip to content

Commit e86aa79

Browse files
committed
Deploy GitHub Actions Self-Hosted Runner on Google Axion C4A VM
Signed-off-by: odidev <[email protected]>
1 parent 6f7fdc7 commit e86aa79

File tree

12 files changed

+279
-0
lines changed

12 files changed

+279
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Deploy GitHub Actions Self-Hosted Runner on Google Axion C4A VM
3+
4+
minutes_to_complete: 30
5+
6+
who_is_this_for: This Learning Path is for DevOps engineers, system administrators, or developers who want to deploy GitHub Actions Self-Hosted Runner on the Google Axion C4A Arm VM.
7+
8+
learning_objectives:
9+
- Provision an Arm VM on the Google Cloud Platform using the C4A Google Axion instance family.
10+
- Set up and validate a GitHub Actions self-hosted runner on the Arm VM.
11+
- Deploy a basic CI workflow with NGINX and verify execution on Arm infrastructure.
12+
13+
prerequisites:
14+
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free?utm_source=google&hl=en) account with billing enabled.
15+
- Familiarity with [GitHub Actions](https://github.com/features/actions) and the Linux command line.
16+
- A GitHub account. You can sign up [here](https://github.com/signup).
17+
18+
author: Zach Lasiuk
19+
20+
##### Tags
21+
skilllevels: Advanced
22+
subjects: CI-CD
23+
cloud_service_providers: Google Cloud
24+
25+
armips:
26+
- Neoverse-V2
27+
28+
tools_software_languages:
29+
- GitHub Actions
30+
- GitHub CLI
31+
32+
operatingsystems:
33+
- Linux
34+
35+
# ================================================================================
36+
# FIXED, DO NOT MODIFY
37+
# ================================================================================
38+
further_reading:
39+
- resource:
40+
title: Google Cloud official website and documentation
41+
link: https://cloud.google.com/docs
42+
type: documentation
43+
44+
- resource:
45+
title: Github-action official website and documentation
46+
link: https://docs.github.com/en/actions
47+
type: documentation
48+
49+
- resource:
50+
title: GitHub Actions Arm runners
51+
link: https://github.blog/news-insights/product-news/arm64-on-github-actions-powering-faster-more-efficient-build-systems/
52+
type: website
53+
54+
55+
weight: 1 # _index.md always has weight of 1 to order correctly
56+
layout: "learningpathall" # All files under learning paths have this same wrapper
57+
learning_path_main_page: "yes" # Indicates this should be surfaced when looking for related content. Only set for _index.md of learning path content.
58+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: "Background"
3+
4+
weight: 2
5+
6+
layout: "learningpathall"
7+
---
8+
9+
## Google Axion C4A series
10+
11+
The Google Axion C4A series is a family of Arm-based virtual machines built on Google’s custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these VMs offer strong performance ideal for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
12+
13+
The C4A series provides a cost-effective alternative to x86 VMs while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
14+
15+
To learn more about Google Axion, refer to the blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu).
16+
17+
## GitHub Actions and CI/CD
18+
19+
GitHub Actions is a powerful CI/CD (Continuous Integration and Continuous Delivery) platform built into GitHub. It allows developers to automate tasks such as building, testing, and deploying code in response to events like code pushes, pull requests, or scheduled jobs—directly from their GitHub repositories. This helps improve development speed, reliability, and collaboration.
20+
21+
A key feature of GitHub Actions is [self-hosted runners](https://docs.github.com/en/actions/concepts/runners/about-self-hosted-runners), which let you run workflows on your own infrastructure instead of GitHub’s hosted servers. This is especially useful for:
22+
23+
- Running on custom hardware, including Arm64-based systems (e.g., Google Axion VMs), to optimize performance and ensure architecture-specific compatibility.
24+
- Private network access, allowing secure interaction with internal services or databases.
25+
- Faster execution, especially for resource-intensive workflows, by using dedicated or high-performance machines.
26+
27+
Self-hosted runners provide more control, flexibility, and cost-efficiency—making them ideal for advanced CI/CD pipelines and platform-specific testing.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: Deploy GitHub Self-Hosted Runner on Google Axion C4A VM
3+
weight: 4
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
10+
## Deploy GitHub Actions Self-Hosted Runner on Google Axion C4A VM and Automate NGINX Deployment.
11+
12+
This Learning Path shows how to deploy a self-hosted GitHub Actions runner on a Google Cloud C4A Arm64 VM running Ubuntu. It covers installing Git and GitHub CLI, authenticating with GitHub, configuring the runner, and automating NGINX deployment using GitHub Actions—all on an Arm64 environment for optimized CI/CD workflows.
13+
14+
### Install Git and GitHub CLI
15+
```console
16+
$ sudo apt update
17+
$ sudo apt install -y git gh
18+
```
19+
Login to GitHub
20+
```console
21+
$ gh auth login
22+
```
23+
The command `gh auth login` is used to authenticate the GitHub CLI with your GitHub account. It allows you to securely log in using a web browser or token, enabling the CLI to interact with repositories, actions, and other GitHub features on your behalf.
24+
25+
![Login to GitHub](./images/gh-auth.png)
26+
27+
Below is the GitHub login UI:
28+
29+
![GitHub UI](./images/login-page.png)
30+
31+
### Test GitHub CLI and Git
32+
Create a test repo:
33+
```console
34+
$ gh repo create test-repo –public
35+
```
36+
Output:
37+
```output
38+
✓ Created repository <your-github-account>/test-repo on GitHub
39+
https://github.com/<your-github-account>/test-repo
40+
```
41+
42+
The command `gh repo create test-repo --public` creates a new public GitHub repository named **test-repo** using the GitHub CLI. It sets the repository visibility to public, meaning anyone can view it
43+
44+
### Configure the Self-Hosted Runner
45+
Go to your repository's **Settings > Actions**, and under the **Runners** section, click on **Add Runner** or view existing self-hosted runners.
46+
If the **Actions** tab is not visible, ensure Actions are enabled by navigating to **Settings > Actions > General**, and select **Allow all actions and reusable workflows**.
47+
48+
![runner](./images/newsh-runner.png)
49+
50+
Then, click on the **New runner** button, followed by **New self-hosted runner**. In the **Add new self-hosted runner** section, proceed as follows:
51+
- Select Linux for the operating system.
52+
- Choose ARM64 for the architecture
53+
54+
![new-runner](./images/new-runner.png)
55+
56+
Next, execute the following instructions on your Google Axion C4A VM:
57+
```console
58+
$ mkdir actions-runner && cd actions-runner# Download the latest runner package
59+
$ curl -o actions-runner-linux-arm64-2.326.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.326.0/actions-runner-linux-arm64-2.326.0.tar.gz
60+
$ echo "ee7c229c979c5152e9f12be16ee9e83ff74c9d9b95c3c1aeb2e9b6d07157ec85 actions-runner-linux-arm64-2.326.0.tar.gz" | shasum -a 256 -c# Extract the installer
61+
$ tar xzf ./actions-runner-linux-arm64-2.326.0.tar.gz
62+
```
63+
Then, configure the VM with the following command:
64+
65+
```console
66+
$ ./config.sh --url https://github.com/<YOUR_USERNAME>/YOUR_REPO --token YOUR_TOKEN
67+
```
68+
Replace `YOUR_USERNAME`, `YOUR_REPO`, and `YOUR_TOKEN` accordingly.
69+
This command links the runner to your GitHub repo using a one-time registration token.
70+
71+
During the command’s execution, you will be prompted to provide the runner group, the name of the runner, and the work folder name. You can accept the defaults by pressing **Enter** at each step. The output will resemble as below:
72+
73+
Output:
74+
75+
```output
76+
--------------------------------------------------------------------------------
77+
| ____ _ _ _ _ _ _ _ _ |
78+
| / ___(_) |_| | | |_ _| |__ / \ ___| |_(_) ___ _ __ ___ |
79+
| | | _| | __| |_| | | | | '_ \ / _ \ / __| __| |/ _ \| '_ \/ __| |
80+
| | |_| | | |_| _ | |_| | |_) | / ___ \ (__| |_| | (_) | | | \__ \ |
81+
| \____|_|\__|_| |_|\__,_|_.__/ /_/ \_\___|\__|_|\___/|_| |_|___/ |
82+
| |
83+
| Self-hosted runner registration |
84+
| |
85+
--------------------------------------------------------------------------------
86+
87+
# Authentication
88+
89+
√ Connected to GitHub
90+
# Runner Registration
91+
Enter the name of the runner group to add this runner to: [press Enter for Default]
92+
Enter the name of runner: [press Enter for lpprojectubuntuarm64]
93+
This runner will have the following labels: 'self-hosted', 'Linux', 'ARM64'
94+
Enter any additional labels (ex. label-1,label-2): [press Enter to skip]
95+
√ Runner successfully added
96+
√ Runner connection is good
97+
```
98+
99+
Finally, start the runner by executing:
100+
```console
101+
$ ./run.sh
102+
```
103+
Output:
104+
105+
```output
106+
√ Connected to GitHub
107+
108+
Current runner version: '2.326.0'
109+
2025-07-15 05:51:13Z: Listening for Jobs
110+
```
111+
The runner will now be visible in the GitHub actions:
112+
113+
![final-runner](./images/final-runner.png)
114+
115+
## Deploy NGINX Using GitHub Actions
116+
This workflow installs and starts the NGINX web server on a self-hosted runner whenever code is pushed to the main branch.
117+
118+
Create the Workflow:
119+
Create a workflow file at `.github/workflows/deploy-nginx.yaml` with the following content:
120+
121+
```yaml
122+
123+
name: Deploy NGINX
124+
125+
on:
126+
push:
127+
branches: [ main ]
128+
129+
jobs:
130+
deploy:
131+
runs-on: self-hosted
132+
steps:
133+
- name: Install NGINX
134+
run: |
135+
sudo apt update
136+
sudo apt install -y nginx
137+
138+
- name: Start NGINX
139+
run: sudo systemctl start nginx
140+
```
141+
### commit and Push:
142+
143+
```console
144+
$ git add .
145+
$ git commit -m "Add NGINX deploy workflow"
146+
$ git push origin main
147+
```
148+
### Access the NGINX Server
149+
Once the workflow completes, open your browser and navigate to:
150+
```
151+
http://<your-public-IP>
152+
```
153+
You should see the NGINX welcome page confirming a successful deployment.
154+
155+
![nginx](./images/nginx.png)
156+
157+
64.4 KB
Loading
164 KB
Loading
57.5 KB
Loading
37.1 KB
Loading
99.9 KB
Loading
69.6 KB
Loading

0 commit comments

Comments
 (0)