Skip to content

Prepare release

Prepare release #137

Workflow file for this run

name: Build Docker image
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
branches:
- main
paths:
- .github/workflows/docker.yaml
- .dockerignore
- Dockerfile
- cmd/**
- internal/**
- go.*
- web/**
- .yarn
- .yarnrc.yml
- biome.jsonc
- package.json
- postcss.config.mjs
- tailwind.config.js
- tsconfig.json
- vite.config.ts
- yarn.lock
jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# We need the entire history to determine the current version
fetch-depth: 0
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Determine tag
id: determine_tag
run: |
TAG="${{ (github.ref_type == 'tag' && github.ref_name) || 'latest' }}"
echo "tag=${TAG#v}" >> "$GITHUB_OUTPUT"
echo -n "revision=" >> "$GITHUB_OUTPUT"
git describe >> "$GITHUB_OUTPUT"
echo -n "date=" >> "$GITHUB_OUTPUT"
date --iso-8601=seconds >> "$GITHUB_OUTPUT"
- name: Build and publish
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/alexgustafsson/cupdate:${{ steps.determine_tag.outputs.tag }}
build-args: |
CUPDATE_VERSION=${{ steps.determine_tag.outputs.revision }}
labels: |
org.opencontainers.image.title=Cupdate
org.opencontainers.image.description=Cupdate keeps track of image updates.
org.opencontainers.image.source=https://github.com/AlexGustafsson/cupdate
org.opencontainers.image.version=${{ steps.determine_tag.outputs.tag }}
org.opencontainers.image.revision=${{ steps.determine_tag.outputs.revision }}
org.opencontainers.image.created=${{ steps.determine_tag.outputs.date }}
org.opencontainers.image.licenses=MIT