build-tasks #105
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-tasks | |
on: | |
# this is meant to be run on an approved PR branch for convenience | |
workflow_dispatch: | |
# We derive a unique ID here to make sure that we don't get into a situation | |
# where different runners pick different tags (eg: for builds near midnight, or | |
# in different time zones). The manifest job picks the final name. | |
env: | |
tag: ghcr.io/${{ github.repository_owner }}/tasks | |
tmptag: ghcr.io/${{ github.repository_owner }}/tasks-tmp:${{ github.run_id }}.${{ github.run_attempt }} | |
jobs: | |
build: | |
strategy: | |
matrix: | |
build: | |
- label: amd64 | |
runner: ubuntu-22.04 | |
- label: arm64 | |
runner: buildjet-2vcpu-ubuntu-2204-arm | |
runs-on: ${{ matrix.build.runner }} | |
timeout-minutes: 10 | |
steps: | |
# NB: no podman on buildjet arm runners | |
- | |
name: Log in to container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.tmptag }}-${{ matrix.build.label }} | |
context: tasks/container | |
file: tasks/container/Containerfile | |
manifest: | |
needs: build | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- | |
name: Login in to container registry | |
run: podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- | |
name: Create manifest | |
run: podman manifest create tasks '${{ env.tmptag }}'-{amd,arm}64 | |
- | |
name: Push with versioned tag | |
run: podman manifest push tasks "${{ env.tag }}:$(date --iso-8601)" | |
- | |
name: Push :latest tag | |
run: podman manifest push tasks "${{ env.tag }}:latest" |