-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (62 loc) · 2.21 KB
/
release.yml
File metadata and controls
72 lines (62 loc) · 2.21 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
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- uses: azure/setup-helm@v4.3.1
with:
version: v3.15.4
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Build release assets
run: make release-dry-run
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Push OCI chart
shell: bash
run: |
repo_owner=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
chart_file=$(find dist/charts -maxdepth 1 -name '*.tgz' | head -n 1)
helm push "$chart_file" "oci://ghcr.io/${repo_owner}/charts"
- name: Publish GitHub release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
title="$(python - <<'PY'
import json
from pathlib import Path
print(json.loads(Path("dist/release-manifest.json").read_text(encoding="utf-8"))["title"])
PY
)"
mapfile -t assets < dist/release-assets.txt
args=()
for asset in "${assets[@]}"; do
args+=("dist/${asset}")
done
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release upload "${GITHUB_REF_NAME}" "${args[@]}" --clobber
gh release edit "${GITHUB_REF_NAME}" --latest --title "${title}" --notes-file dist/release-notes.md
release_id="$(gh release view "${GITHUB_REF_NAME}" --json databaseId --jq .databaseId)"
gh api "repos/${GITHUB_REPOSITORY}/releases/${release_id}" --method PATCH -F prerelease=false >/dev/null
else
gh release create "${GITHUB_REF_NAME}" \
--verify-tag \
--latest \
--title "${title}" \
--notes-file dist/release-notes.md \
"${args[@]}"
fi