Skip to content

[scale-set] build images in public repo vs private repo #2

[scale-set] build images in public repo vs private repo

[scale-set] build images in public repo vs private repo #2

name: Build and Push Actions Runner scale-set image
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "images/ubuntu/dockerfiles-scaleset/**"
pull_request: # to test the workflow
branches:
- main
paths:
- "images/ubuntu/dockerfiles-scaleset/**"
permissions:
contents: write
packages: write
id-token: write
jobs:
build:
strategy:
matrix:
base_image: [22.04-devel, 24.04-devel]
runs-on: ubuntu-xl
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
fetch-depth: 1
- name: Set up Git
shell: bash
env:
ACCESS_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
run: |
go env -w GOPRIVATE="github.com/devzero-inc/*"
git config --global url."https://x-access-token:$ACCESS_TOKEN@github.com/".insteadOf "https://github.com/"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/#-action@v3
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and Push Docker image
shell: bash
run: |
cd images/ubuntu/dockerfiles-scaleset
TAG=${{ matrix.base_image }} BASE_IMAGE=devzeroinc/gha-runner-image-ubuntu:${{ matrix.base_image}} \
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
make build-image
else
make push
fi