Repository navigation
66 lines (58 loc) · 1.91 KB
/
Copy pathdocker-publish.yml
File metadata and controls
66 lines (58 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Docker publish
# Called directly from release.yml as a second job in the *same*
# workflow run (workflow_call), not triggered by the release event
# itself -- GitHub's anti-recursion rule means events performed with
# the default GITHUB_TOKEN (which release.yml uses to create the
# release) never trigger other workflows, confirmed empirically in
# sigennut before this repo got the same fix.
#
# workflow_dispatch lets this be re-run by hand for any already-tagged
# version, e.g. to backfill a release that predates this workflow:
# gh workflow run docker-publish.yml -f version=0.1.0
on:
workflow_call:
inputs:
version:
required: true
type: string
workflow_dispatch:
inputs:
version:
description: "Version to build and push (must match an existing git tag)"
required: true
type: string
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
miklosbagi/invforge:${{ inputs.version }}
miklosbagi/invforge:latest
ghcr.io/miklosbagi/invforge:${{ inputs.version }}
ghcr.io/miklosbagi/invforge:latest