Add CI for provider images #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
name: Unit Tests & Code Quality | |
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: Build bootstrap provider image | |
run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap | |
- name: Build controlplane provider image | |
run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-build-bootstrap | |
- name: Publish bootstrap provider image | |
run: BOOTSTRAP_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-bootstrap | |
- name: Publish controlplane provider image | |
run: CONTROLPLANE_IMAGE_TAG=${{ steps.determine.outputs.version }} docker-publish-controlplane |