Skip to content

fix: minikube failure on ubuntu images #134

fix: minikube failure on ubuntu images

fix: minikube failure on ubuntu images #134

name: Publish Runner Image by using Packer
on:
push:
branches:
- main
paths:
- 'images/**'
- '.github/workflows/packer-publish-image.yaml'
pull_request:
branches:
- main
paths:
- 'images/**'
- '.github/workflows/packer-publish-image.yaml'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/actions-runner
PACKER_PRODUCT_VERSION: "1.8.6"
RUNNER_VERSION: 2.322.0
jobs:
packer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: ${{ env.PACKER_PRODUCT_VERSION }}
- name: Run `packer init`
id: init
run: |
packer init ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl
- name: Run `packer validate template`
id: validate
run: |
packer validate ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl
- name: Run `packer build`
run: |
packer build --var artifact_image_repository=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} --var artifact_image_tag=${{ env.RUNNER_VERSION }}rc${{ github.run_number }} ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image to ${{ env.REGISTRY }}
if: github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RUNNER_VERSION }}rc${{ github.run_number }}