4
4
tags :
5
5
- ' v*'
6
6
7
+ permissions :
8
+ contents : write # needed to write releases
9
+ id-token : write # needed for keyless signing
10
+ packages : write # needed for ghcr access
11
+
12
+ env :
13
+ IMAGE : " ghcr.io/fluxcd/${{ github.event.repository.name }}"
14
+
7
15
jobs :
8
16
build-push :
9
17
runs-on : ubuntu-latest
@@ -15,24 +23,28 @@ jobs:
15
23
run : |
16
24
VERSION=$(grep 'VERSION' pkg/version/version.go | awk '{ print $4 }' | tr -d '"')
17
25
CHANGELOG="https://github.com/fluxcd/flagger/blob/main/CHANGELOG.md#$(echo $VERSION | tr -d '.')"
26
+ echo "[CHANGELOG](${CHANGELOG})" > notes.md
18
27
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
19
28
echo ::set-output name=VERSION::${VERSION}
20
- echo ::set-output name=CHANGELOG::${CHANGELOG}
21
29
- name : Setup QEMU
22
30
uses : docker/setup-qemu-action@v1
23
- with :
24
- platforms : all
25
31
- name : Setup Docker Buildx
26
32
id : buildx
27
33
uses : docker/setup-buildx-action@v1
28
- with :
29
- buildkitd-flags : " --debug"
30
34
- name : Login to GitHub Container Registry
31
35
uses : docker/login-action@v1
32
36
with :
33
37
registry : ghcr.io
34
38
username : fluxcdbot
35
39
password : ${{ secrets.GHCR_TOKEN }}
40
+ - name : Generate image meta
41
+ id : meta
42
+ uses : docker/metadata-action@v3
43
+ with :
44
+ images : |
45
+ ${{ env.IMAGE }}
46
+ tags : |
47
+ type=raw,value=${{ steps.prep.outputs.VERSION }}
36
48
- name : Publish image
37
49
uses : docker/build-push-action@v2
38
50
with :
@@ -43,42 +55,31 @@ jobs:
43
55
platforms : linux/amd64,linux/arm64,linux/arm/v7
44
56
build-args : |
45
57
REVISON=${{ github.sha }}
46
- tags : |
47
- ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }}
48
- labels : |
49
- org.opencontainers.image.title=${{ github.event.repository.name }}
50
- org.opencontainers.image.description=${{ github.event.repository.description }}
51
- org.opencontainers.image.url=${{ github.event.repository.html_url }}
52
- org.opencontainers.image.source=${{ github.event.repository.html_url }}
53
- org.opencontainers.image.revision=${{ github.sha }}
54
- org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
55
- org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
58
+ tags : ${{ steps.meta.outputs.tags }}
59
+ labels : ${{ steps.meta.outputs.labels }}
56
60
- name : Sign image
57
61
run : |
58
62
echo -n "${{secrets.COSIGN_PASSWORD}}" | \
59
63
cosign sign -key ./.cosign/cosign.key -a git_sha=$GITHUB_SHA \
60
- ghcr.io/fluxcd/flagger :${{ steps.prep.outputs.VERSION }}
64
+ ${{ env.IMAGE }} :${{ steps.prep.outputs.VERSION }}
61
65
- name : Check images
62
66
run : |
63
- docker buildx imagetools inspect ghcr.io/fluxcd/flagger :${{ steps.prep.outputs.VERSION }}
67
+ docker buildx imagetools inspect ${{ env.IMAGE }} :${{ steps.prep.outputs.VERSION }}
64
68
- name : Verifiy image signature
65
69
run : |
66
70
cosign verify -key ./.cosign/cosign.pub \
67
- ghcr.io/fluxcd/flagger :${{ steps.prep.outputs.VERSION }}
71
+ ${{ env.IMAGE }} :${{ steps.prep.outputs.VERSION }}
68
72
- name : Publish Helm charts
69
73
uses :
stefanprodan/[email protected]
70
74
with :
71
75
token : ${{ secrets.GITHUB_TOKEN }}
72
76
charts_url : https://flagger.app
73
77
linting : off
74
- - name : Create release
75
- uses : actions/create-release@latest
78
+ - uses : anchore/sbom-action/download-syft@v0
79
+ - name : Create release and SBOM
80
+ uses : goreleaser/goreleaser-action@v2
81
+ with :
82
+ version : latest
83
+ args : release --release-notes=notes.md --rm-dist --skip-validate
76
84
env :
77
85
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78
- with :
79
- tag_name : ${{ github.ref }}
80
- release_name : ${{ github.ref }}
81
- draft : false
82
- prerelease : false
83
- body : |
84
- [CHANGELOG](${{ steps.prep.outputs.CHANGELOG }})
0 commit comments