-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (71 loc) · 3.13 KB
/
release-please.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
name: Release Please
on:
push:
branches:
- main
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
permissions:
contents: write
pull-requests: write
env:
IMAGE_NAME: phiag/mta-sts-exporter
jobs:
release-please:
runs-on: ubuntu-24.04
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
id: release
- name: Checkout
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Go
if: ${{ steps.release.outputs.release_created }}
uses: ./.github/actions/setup-go
- name: Login to Docker Hub
if: ${{ steps.release.outputs.release_created }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export commit timestamp
if: ${{ steps.release.outputs.release_created }}
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Setup ko
if: ${{ steps.release.outputs.release_created }}
uses: ./.github/actions/setup-ko
env:
KO_DOCKER_REPO: ${{ secrets.DOCKERHUB_USERNAME }}
- name: Publish
if: ${{ steps.release.outputs.release_created }}
run: >
ko build
--base-import-paths
--tags latest
--tags ${{ github.sha }}
--tags ${{ steps.release.outputs.major }}
--tags ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
--tags ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
--image-label org.opencontainers.image.created=$(date -d @${{ env.SOURCE_DATE_EPOCH }} +'%Y-%m-%dT%H:%M:%SZ')
--image-label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
--image-label org.opencontainers.image.version=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
--image-label org.opencontainers.image.revision=${{ github.sha }}
--image-label org.opencontainers.image.licenses=MIT
--image-label org.opencontainers.image.authors=phi.ag
--image-label org.opencontainers.image.vendor=phi.ag
--image-label org.opencontainers.image.authors=${{ github.server_url }}/${{ github.repository }}
env:
KO_DEFAULTPLATFORMS: linux/amd64,linux/arm64
KO_DATA_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
- name: Update Docker Hub description
if: ${{ steps.release.outputs.release_created }}
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
short-description: ${{ github.event.repository.description }}
enable-url-completion: true