Skip to content

Update to RunnerSet, use concurrency control #25

Update to RunnerSet, use concurrency control

Update to RunnerSet, use concurrency control #25

Workflow file for this run

name: "rpmbuild"
concurrency:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths:
- rpm/**
- .github/workflows/rpmbuild.yml
pull_request:
types: [opened, synchronize, reopened]
paths:
- rpm/**
- .github/workflows/rpmbuild.yml
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
centos:
- 'centos8'
steps:
- name: "Checkout source code at current commit"
uses: actions/checkout@v3
- name: Prepare tags for Docker image
id: prepare
env:
BUILDER: rpmbuild
MATRIX_TAG: ${{matrix.centos}}
run: |
DOCKER_IMAGE=${{ github.repository }}-${BUILDER}
TAGS="${DOCKER_IMAGE}:${MATRIX_TAG},${DOCKER_IMAGE}:latest"
COMMIT_SHA="${GITHUB_SHA}"
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.pull_request.number }}
COMMIT_SHA=${{ github.event.pull_request.head.sha }}
fi
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${COMMIT_SHA:0:7}"
if [[ -n $VERSION ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: "Build and push RPM builder docker image to DockerHub"
id: docker_build_builder
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
provenance: false
tags: ${{ steps.prepare.outputs.tags }}
file: rpm/Dockerfile.${{matrix.centos}}