Files
obscura/.github/workflows/docker.yml
T
SGavrl 56260822b9 ci: auto-build and push Docker image on release tag
Adds a workflow that triggers on v* tag pushes and:
- Logs into Docker Hub using DOCKERHUB_USERNAME + DOCKERHUB_TOKEN secrets
- Builds the image from the existing Dockerfile
- Tags it with both the version (e.g. 0.1.4) and 'latest'
- Pushes both tags

GitHub Actions cache is used for layers to speed up subsequent builds.
2026-05-13 22:22:31 +00:00

40 lines
947 B
YAML

name: Docker
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/obscura:${{ steps.version.outputs.version }}
${{ secrets.DOCKERHUB_USERNAME }}/obscura:latest
cache-from: type=gha
cache-to: type=gha,mode=max