diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml new file mode 100644 index 00000000..7a834de7 --- /dev/null +++ b/.github/workflows/publish-images.yaml @@ -0,0 +1,55 @@ +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