-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (77 loc) · 2.37 KB
/
release.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
75
76
77
78
79
80
81
82
name: release
on:
push:
tags:
- 'v*'
branches:
- "main"
permissions:
contents: write
packages: write
env:
REGISTRY: docker.io
REPOSITORY: linode
IMAGE: linode-cosi-driver
jobs:
changelog:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- id: semver_parser
uses: release-kit/semver@v2
with:
string: ${{ github.ref_name }}
- id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
excludeTypes: ""
excludeScopes: ""
- uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: ${{ steps.semver_parser.outputs.prerelease == '' }}
prerelease: ${{ steps.semver_parser.outputs.prerelease != '' }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Capture latest tag if exists
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
semver_only: true
with_initial_version: true
initial_version: v0.0.0
- id: tags
run: |
./scripts/tags.sh \
"${{ env.REGISTRY }}/${{ env.REPOSITORY }}/${{ env.IMAGE }}" \
"${{ github.sha }}" \
"${{ github.ref_name }}" \
"${{ steps.get-latest-tag.outputs.tag }}" \
"${GITHUB_OUTPUT}"
- uses: docker/build-push-action@v6
with:
push: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main') }}
load: ${{ !(startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')) }}
tags: ${{ steps.tags.outputs.all }}
build-args: |
VERSION=${{ steps.tags.outputs.version }}
target: runtime
- name: Scan image using Grype
id: grype
uses: anchore/scan-action@v5
with:
image: ${{ steps.tags.outputs.full_version }}
output-format: table