This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
170 lines (145 loc) · 4.87 KB
/
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
permissions:
packages: write
contents: write
jobs:
artifacts:
name: Create artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
# NOTE(chrisgacsal): Use actions/cache for caching Go dependency and build caches
# as it provides better flexibility like setting the cache key which reduces cache misses significantly.
cache: false
go-version-file: '.go-version'
- name: Free up disk space
run: |
df -h
# Remove .NET related tooling
sudo du -sh /usr/share/dotnet
sudo rm -rf /usr/share/dotnet
# Remove Android related tooling
sudo du -sh /usr/local/lib/android
sudo rm -rf /usr/local/lib/android
# Remove CodeQL
sudo du -sh /opt/hostedtoolcache/CodeQL
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h
- name: Setup Go caching
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.ref_name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ github.ref_name }}-
${{ runner.os }}-go-${{ github.event.repository.default_branch }}-
- name: Create vmclarity-cli manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-vmclarity-cli
- name: Create Cloudformation manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-cloudformation
- name: Create Azure Bicep manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-bicep
- name: Create Docker Compose manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-docker-compose
- name: Create Google Cloud Deployment manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-gcp-deployment
- name: Upload
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: artifacts
path: |
dist/*.tar.gz
dist/*.tgz
dist/*.sha256sum
dist/bicep/vmclarity.json
dist/bicep/vmclarity-UI.json
if-no-files-found: error
compression-level: 0
verification:
name: Verification
uses: ./.github/workflows/reusable-verification.yml
secrets: inherit
publish-helm-chart:
needs: verification
name: Publish Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create Helm Chart package
env:
VERSION: ${{ github.ref_name }}
run: make dist-helm-chart
- name: Login to GitHub Container Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package and Publish Helm Chart
env:
VERSION: ${{ github.ref_name }}
run: make publish-helm-chart
build-and-push:
needs:
- artifacts
- verification
- publish-helm-chart
name: Build
uses: ./.github/workflows/build-and-push-components-registry.yml
with:
image_tag: ${{ github.ref_name }}
main-release:
needs:
- artifacts
- verification
- publish-helm-chart
- build-and-push
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: artifacts
path: dist
- name: Generate changelog
env:
VERSION: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make generate-release-notes
- name: Upload release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "dist/*.tar.gz,dist/*.sha256sum,dist/bicep/vmclarity.json,dist/bicep/vmclarity-UI.json"
bodyFile: "dist/CHANGELOG.md"
draft: true
name: "Release ${{ github.ref_name }}"
updateOnlyUnreleased: true