-
Notifications
You must be signed in to change notification settings - Fork 800
116 lines (102 loc) · 4.29 KB
/
Copy pathrelease.yaml
File metadata and controls
116 lines (102 loc) · 4.29 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
name: Release Charts
on:
push:
branches:
- main
permissions:
contents: read
jobs:
release:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
packages: write # needed for ghcr access
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
with:
version: v4.0.5
- name: Add dependent repositories
run: |
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add prometheus https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana-community.github.io/helm-charts
helm repo add jaeger https://jaegertracing.github.io/helm-charts
helm repo add opensearch https://opensearch-project.github.io/helm-charts
- name: GPG configuration
run: |-
echo "$GPG_KEY" > "$GPG_KEY_PATH"
mkdir -p "$HOME/.gnupg"
chmod 0700 "$HOME/.gnupg"
echo "use-agent" > "$HOME/.gnupg/gpg.conf"
echo "pinentry-mode loopback" >> "$HOME/.gnupg/gpg.conf"
echo "allow-loopback-pinentry" > "$HOME/.gnupg/gpg-agent.conf"
echo "max-cache-ttl 86400" >> "$HOME/.gnupg/gpg-agent.conf"
echo "default-cache-ttl 86400" >> "$HOME/.gnupg/gpg-agent.conf"
gpgconf --kill gpg-agent
gpgconf --launch gpg-agent
gpg --batch --yes --passphrase-fd 0 --import "$GPG_KEY_PATH" <<< "$GPG_PASSPHRASE"
gpg --batch --yes --export "$GPG_KEY_ID" > ~/.gnupg/pubring.gpg
gpg --batch --yes --passphrase-fd 0 --export-secret-keys "$GPG_KEY_ID" > ~/.gnupg/secring.gpg <<< "$GPG_PASSPHRASE"
cat > "$GPG_PASSPHRASE_FILE" <<< "$GPG_PASSPHRASE"
env:
GPG_KEY_ID: "${{ vars.GPG_KEY_ID }}"
GPG_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
GPG_PASSPHRASE_FILE: "${{ runner.temp }}/gpg-passphrase"
GPG_KEY_PATH: "${{ runner.temp }}/private.key"
- name: Run chart-releaser
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
with:
charts_dir: charts
config: .github/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true
CR_SIGN: true
CR_KEY: "${{ vars.GPG_KEY_NAME }}"
CR_KEYRING: "~/.gnupg/secring.gpg"
CR_PASSPHRASE_FILE: "${{ runner.temp }}/gpg-passphrase"
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Helm OCI Registry
env:
HELM_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
HELM_USERNAME: ${{ github.actor }}
run: |
echo "$HELM_PASSWORD" | helm registry login ghcr.io \
--username "$HELM_USERNAME" \
--password-stdin
- name: Push charts to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
echo "Pushing ${pkg} to oci://ghcr.io/${GITHUB_REPOSITORY}"
helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY}"
done
- name: Fetch newly created tags
run: |
git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
git fetch --tags origin
- name: Enhance release notes with OpenTelemetry links
run: .github/scripts/enhance-release-notes.sh
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_REPOSITORY: "${{ github.repository }}"