Build container on new tag #27
Workflow file for this run
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: Build container on new tag | |
on: | |
# allows manual start | |
workflow_dispatch: | |
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#create | |
create: | |
env: | |
# container repository | |
CR_HOST: ${{ vars.CONTAINER_REPO_HOST }} | |
CR_USER: ${{ vars.CONTAINER_REPO_USER }} | |
CR_PASS: ${{ secrets.CONTAINER_REPO_PASS }} | |
jobs: | |
BuildNewContainer: | |
runs-on: self-hosted | |
if: github.event.ref_type == 'tag' | |
steps: | |
# bugs, bugs everywhere | |
# https://github.com/actions/actions-runner-controller/issues/893 | |
- name: Set up Docker context for buildx | |
id: buildx-context | |
run: | | |
docker context create builders | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
# my repo is only available via IPv6 | |
# GitHub hosted runners don't have connectivity, | |
# thus it needs to run on self-hosted | |
- name: Log in to container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.CR_HOST }} | |
username: ${{ env.CR_USER }} | |
password: ${{ env.CR_PASS }} | |
- name: Build and push container | |
uses: docker/[email protected] | |
with: | |
tags: ${{ env.CR_HOST }}/${{ env.CR_USER }}/k8s-haproxy-external-lb:${{ github.event.ref }} | |
file: "Containerfile" | |
push: true |