66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Publish Docker Image
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
release:
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
success:
|
|
description: "Did the flow succeed?"
|
|
value: ${{ jobs.publish.outputs.success }}
|
|
|
|
env:
|
|
REGISTRY_URL: git.tainton.uk
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
# permissions:
|
|
# packages: write
|
|
# contents: read
|
|
# attestations: write
|
|
# id-token: write
|
|
outputs:
|
|
success: ${{ steps.set_flag.outputs.success }}
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4.1.7
|
|
with:
|
|
ref: ${{ inputs.release }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Package Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY_URL }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY_URL }}/${{ gitea.repository }}
|
|
tags: |
|
|
type=semver,pattern=v{{version}},value=${{ inputs.release }}
|
|
|
|
- name: Build and push Docker image
|
|
id: push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: |
|
|
${{ env.REGISTRY_URL }}/${{ gitea.repository }}:latest
|
|
${{ env.REGISTRY_URL }}/${{ gitea.repository }}:${{ inputs.release }}
|
|
|
|
- name: Set success flag
|
|
id: set_flag
|
|
run: echo "success=true" >> "$GITEA_OUTPUT"
|