You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This GitHub Action example workflow automates the creation of a GitHub Actions Runner on Hetzner Cloud, builds a Container image with Podman using that runner, and then automatically deletes the runner to avoid unnecessary costs. It utilizes the Cyclenerd/hcloud-github-runner GitHub Action for managing the runner lifecycle and leverages the podman build command for efficient image building and pushing to the GitHub Container Registry.
Image used: rocky-9 Rocky Linux 9
name: "Podman"on:
workflow_dispatch:
jobs:
create-runner:
name: Create Runnerruns-on: ubuntu-24.04outputs:
label: ${{ steps.create-runner.outputs.label }}server_id: ${{ steps.create-runner.outputs.server_id }}steps:
- name: Create runnerid: create-runneruses: Cyclenerd/hcloud-github-runner@v1with:
mode: creategithub_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}hcloud_token: ${{ secrets.HCLOUD_TOKEN }}server_type: cx22# Use Rocky Linux 9 base imageimage: rocky-9# Install Podmanpre_runner_script: | dnf install podman -y# Add SSH key to disable root password generation and email notifications# ssh_key: 123build:
name: Build Imageneeds:
- create-runner # required to get output from the create-runner jobruns-on: ${{ needs.create-runner.outputs.label }}steps:
- name: Checkout 🛎️uses: actions/checkout@v4
- name: Login to GitHub container registry 🏭# https://docs.docker.com/reference/cli/docker/login/run: podman login ghcr.io -u "${{ github.repository_owner }}" -p "${{ secrets.github_token }}"
- name: Build Container image 🧪# Replace "ghcr.io/cyclenerd/hcloud-github-runner:example"run: | podman build . \ --file "Dockerfile" \ --tag "ghcr.io/cyclenerd/hcloud-github-runner:example"
- name: Push Container image 📤# Replace "ghcr.io/cyclenerd/hcloud-github-runner:example"run: podman push "ghcr.io/cyclenerd/hcloud-github-runner:example"delete-runner:
name: Delete Runnerneeds:
- create-runner # required to get output from the create-runner job
- build # required to wait when the main job is doneruns-on: ubuntu-24.04if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobssteps:
- name: Delete runneruses: Cyclenerd/hcloud-github-runner@v1with:
mode: deletegithub_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}hcloud_token: ${{ secrets.HCLOUD_TOKEN }}name: ${{ needs.create-runner.outputs.label }}server_id: ${{ needs.create-runner.outputs.server_id }}
The text was updated successfully, but these errors were encountered:
This GitHub Action example workflow automates the creation of a GitHub Actions Runner on Hetzner Cloud, builds a Container image with Podman using that runner, and then automatically deletes the runner to avoid unnecessary costs. It utilizes the
Cyclenerd/hcloud-github-runner
GitHub Action for managing the runner lifecycle and leverages thepodman build
command for efficient image building and pushing to the GitHub Container Registry.Image used:
rocky-9
Rocky Linux 9The text was updated successfully, but these errors were encountered: