-
Notifications
You must be signed in to change notification settings - Fork 94
98 lines (87 loc) · 3.49 KB
/
helm-release.yml
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
name: Release Helm Chart
on:
push:
tags:
- "*\\.*\\.*" # only run on version tags
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get the version tags
id: get_version
run: |
# Enable pipefail so git command failures do not result in null versions downstream
set -x
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
echo ::set-output name=CORE_VERSION::$(\
git ls-remote --tags --refs --sort="v:refname" \
https://github.com/PrefectHQ/prefect.git | grep "tags/1." | tail -n1 | sed 's/.*\///' \
)
echo ::set-output name=UI_VERSION::$(\
git ls-remote --tags --refs --sort="v:refname" \
https://github.com/PrefectHQ/ui.git | tail -n1 | sed 's/.*\///' \
)
- 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@v1
with:
version: v3.4.1
- name: Prepare GPG key for signing
run: |
gpg_dir=/tmp/.gpg
mkdir "$gpg_dir"
keyring="$gpg_dir/secring.gpg"
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "SIGN_KEYRING=$keyring" >> "$GITHUB_ENV"
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Package helm chart
run: |
mkdir /tmp/chart
cd helm
# Update the core version tag
sed -i "s/^prefectVersionTag:.*$/prefectVersionTag: \"$CORE_VERSION\"/" prefect-server/values.yaml
# Update the UI version tag
sed -i "s/^uiVersionTag:.*$/uiVersionTag: \"$UI_VERSION\"/" prefect-server/values.yaml
helm package prefect-server \
--destination /tmp/chart \
--dependency-update \
--version $VERSION \
--app-version $VERSION \
--sign --key 'michael@prefect.io' \
--keyring $SIGN_KEYRING \
--passphrase-file $SIGN_PASSPHRASE_FILE
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
CORE_VERSION: ${{ steps.get_version.outputs.CORE_VERSION }}
UI_VERSION: ${{ steps.get_version.outputs.UI_VERSION }}
SIGN_KEYRING: ${{ env.SIGN_KEYRING }}
SIGN_PASSPHRASE_FILE: ${{ env.SIGN_PASSPHRASE_FILE }}
- name: Update chart index
run: |
git stash # Stash changes to the values.yaml so checkout doesn't complain
git checkout gh-pages
helm repo index /tmp/chart --url https://prefecthq.github.io/server/charts --merge ./index.yaml
- name: Commit and push
run: |
cp /tmp/chart/index.yaml .
cp /tmp/chart/prefect-server-$VERSION.* ./charts
git add ./index.yaml ./charts/prefect-server-$VERSION.*
git commit -m "Release $VERSION"
git push origin gh-pages
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}