Skip to content

Add CI for provider images #5

Add CI for provider images

Add CI for provider images #5

name: Publish Images
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
# TODO: remove before merge
pull_request:
permissions:
contents: read
jobs:
test:
permissions:
contents: read # for actions/checkout to fetch code
packages: write # for publishing docker images
name: Build and Publish Images
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Determine branch
id: determine
env:
BRANCH: ${{ github.ref }}
run: |
BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists
if [[ "${BRANCH}" == "main" ]]; then
echo "version=latest" >> "$GITHUB_OUTPUT"
elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then
echo "version=v${BRANCH#release-}" >> "$GITHUB_OUTPUT"
else
# TODO: Remove before merge, only for testing
echo "Use Branch ${BRANCH} only for testing."
echo "version=latest" >> "$GITHUB_OUTPUT"
# exit 1
fi
- name: Check out code
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build bootstrap provider image
run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap
- name: Build controlplane provider image
run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap
- name: Publish bootstrap provider image
run: make BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-bootstrap
- name: Publish controlplane provider image
run: make CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-push-controlplane