-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (70 loc) · 2.27 KB
/
go.yaml
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
name: Go
on:
push:
paths-ignore:
- '**.md'
jobs:
build:
name: 📦 Build & Test
runs-on: ubuntu-latest
outputs:
image: ${{ steps.meta.outputs.tags }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch,pattern=snapshot-{{sha}}
labels: |
[email protected]:${{ github.repository }}.git
org.opencontainers.image.version=${{ github.head_ref || github.ref_name }}
org.opencontainers.image.revision=${{ github.sha }}
de.interhyp.image.servicename=metadata-service
- id: build-push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release:
name: 🚀 Release
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: semantic-release
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
allow-initial-development-versions: true # remove to trigger an initial 1.0.0 release
changelog-generator-opt: "emojis=true"
hooks: goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: repository-id
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- if: steps.semantic-release.outputs.version != ''
run: |
TARGET=ghcr.io/${{ steps.repository-id.outputs.lowercase }}:${{ steps.semantic-release.outputs.version }}
SOURCE=${{ needs.build.outputs.image }}
docker pull $SOURCE
docker tag $SOURCE $TARGET
docker push $TARGET