-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.36 KB
/
_release.yaml
File metadata and controls
42 lines (33 loc) · 1.36 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
name: Release
on:
workflow_call:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check tag
run: |
if [[ ! "${GITHUB_REF_NAME}" =~ ^[a-z0-9]+(-[a-z0-9]+)*@[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)[0-9]+)?$ ]]; then
echo "Invalid tag format: '${GITHUB_REF_NAME}'. Expected 'kebab-case@X.Y.Z[-(alpha|beta|rc)N]', e.g., 'my-app@1.2.3' or 'my-app@1.2.3-beta1'"
exit 1
fi
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Set SCHEMA_FILE env var
run: |
echo "SCHEMA_FILE=${GITHUB_REF_NAME%@*}.schema.json" >> $GITHUB_ENV
- name: Create GitHub release with schema for the tagged helm chart
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
files: |
${{ env.SCHEMA_FILE }}
generate_release_notes: true
- name: Push tagged helm chart to registry
run: |
set -x
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.repository_owner }} --password-stdin
IFS='@' read -r NAME VERSION <<< "${GITHUB_REF_NAME}"
REGISTRY=oci://ghcr.io/diamondlightsource
helm push "${NAME}-${VERSION}.tgz" ${REGISTRY}