-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (105 loc) · 3.55 KB
/
Copy pathstable-release.yaml
File metadata and controls
118 lines (105 loc) · 3.55 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
name: Create Stable Release
on:
workflow_dispatch:
inputs:
plugin:
description: Plugin to release
required: true
type: choice
options:
- arthas
- golang
- inspektor-gadget
- kubernetes-logs
- opensearch
- postgres
- s3
- sql-server
version:
description: Stable version to release, without the v prefix (e.g. 1.2.3).
required: true
type: string
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Determine version
id: version
env:
OWNER: ${{ github.repository_owner }}
INPUT_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
version="${INPUT_VERSION#v}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
echo "image_owner=$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- 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: ${{ inputs.plugin }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
PLUGIN=${{ inputs.plugin }}
VERSION=${{ steps.version.outputs.tag }}
BUILD_DATE=${{ github.event.repository.updated_at }}
tags: |
ghcr.io/${{ steps.version.outputs.image_owner }}/mission-control-plugins/${{ inputs.plugin }}:${{ steps.version.outputs.tag }}
ghcr.io/${{ steps.version.outputs.image_owner }}/mission-control-plugins/${{ inputs.plugin }}:latest
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v4.0.4
- name: Package Helm chart
env:
PLUGIN: ${{ inputs.plugin }}
VERSION: ${{ steps.version.outputs.version }}
APP_VERSION: ${{ steps.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 ${{ steps.version.outputs.tag }} of mission-control-plugin-${{ inputs.plugin }}"
branch: gh-pages
repository: ./chart-index
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.tag }}
prerelease: false
generate_release_notes: true