-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (171 loc) · 5.59 KB
/
Copy pathrelease.yaml
File metadata and controls
185 lines (171 loc) · 5.59 KB
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Create Beta Release
on:
push:
branches:
- main
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
plugins: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
arthas:
- arthas/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
golang:
- golang/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
inspektor-gadget:
- inspektor-gadget/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
kubernetes-logs:
- kubernetes-logs/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
opensearch:
- opensearch/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
postgres:
- postgres/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
s3:
- s3/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
sql-server:
- sql-server/**
- Makefile
- Taskfile.yml
- .github/workflows/release.yaml
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
image_owner: ${{ steps.version.outputs.image_owner }}
steps:
- name: Determine beta version from latest stable GitHub release
id: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
OWNER: ${{ github.repository_owner }}
run: |
set -euo pipefail
latest_stable=$(gh release list --repo "$REPO" --exclude-drafts --limit 100 --json tagName,isPrerelease --jq '[.[] | select(.isPrerelease | not)][0].tagName // "v0.0.0"')
base="${latest_stable#v}"
version="${base}-beta.${GITHUB_RUN_NUMBER}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
echo "image_owner=$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
publish:
name: Publish ${{ matrix.plugin }} beta
needs:
- changes
- version
if: needs.changes.outputs.plugins != '[]'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
plugin: ${{ fromJSON(needs.changes.outputs.plugins) }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.plugin }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
PLUGIN=${{ matrix.plugin }}
VERSION=${{ needs.version.outputs.tag }}
BUILD_DATE=${{ github.event.repository.updated_at }}
tags: |
ghcr.io/${{ needs.version.outputs.image_owner }}/mission-control-plugins/${{ matrix.plugin }}:${{ needs.version.outputs.tag }}
ghcr.io/${{ needs.version.outputs.image_owner }}/mission-control-plugins/${{ matrix.plugin }}:beta
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v4.0.4
- name: Package Helm chart
env:
PLUGIN: ${{ matrix.plugin }}
VERSION: ${{ needs.version.outputs.version }}
APP_VERSION: ${{ needs.version.outputs.tag }}
run: |
set -euo pipefail
chart_dir="$PLUGIN/chart"
sed -i -E "s/^version:.*/version: ${VERSION}/" "$chart_dir/Chart.yaml"
sed -i -E "s/^appVersion:.*/appVersion: \"${APP_VERSION}\"/" "$chart_dir/Chart.yaml"
helm package -d dist "$chart_dir"
- name: Clone charts repo
uses: actions/checkout@v6
with:
repository: "${{ github.repository_owner }}/charts"
path: chart-index
token: "${{ secrets.FLANKBOT }}"
- name: Update chart repo
run: |
set -euo pipefail
cd chart-index
cp ../dist/*.tgz ./
helm repo index --merge index.yaml .
- name: Push chart index
uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "Release beta ${{ needs.version.outputs.tag }} of mission-control-plugin-${{ matrix.plugin }}"
branch: gh-pages
repository: ./chart-index
github-prerelease:
name: Create GitHub beta prerelease
needs:
- changes
- version
- publish
if: needs.changes.outputs.plugins != '[]'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version.outputs.tag }}
name: ${{ needs.version.outputs.tag }}
prerelease: true
generate_release_notes: true