-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.46 KB
/
publish-release.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Create Release and Push to Container Registries
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: The tag to publish
required: true
jobs:
publish-image:
name: Build and Push to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: refs/tags/${{ github.event.inputs.tag }}
- run: |
echo REPOSITORY="$(
echo "${GITHUB_REPOSITORY}" |
tr '[:upper:]' '[:lower:]' |
sed 's/docker-//'
)" >"${GITHUB_ENV}"
- uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/[email protected]
with:
images: |
${{ env.REPOSITORY }}
ghcr.io/${{ env.REPOSITORY }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/[email protected]
- uses: docker/[email protected]
- id: docker_build
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: ghalactic/github-release-from-tag@v5
with:
summaryEnabled: false
- uses: peter-evans/[email protected]
with:
repository: kineticcafe/${{ env.REPOSITORY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}