-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (50 loc) · 1.96 KB
/
update-appversion.yaml
File metadata and controls
61 lines (50 loc) · 1.96 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
name: Update App Version
on:
repository_dispatch:
types: [logtide-release]
permissions:
contents: write
actions: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump versions in Chart.yaml
id: bump
run: |
APP_VERSION="${{ github.event.client_payload.version }}"
CURRENT_APP=$(grep '^appVersion:' charts/logtide/Chart.yaml | awk '{print $2}' | tr -d '"')
if [ "$CURRENT_APP" = "$APP_VERSION" ]; then
echo "already at appVersion $APP_VERSION, skipping"
echo "changed=false" >> $GITHUB_OUTPUT
exit 0
fi
CURRENT=$(grep '^version:' charts/logtide/Chart.yaml | awk '{print $2}')
MAJOR=$(echo $CURRENT | cut -d. -f1)
MINOR=$(echo $CURRENT | cut -d. -f2)
PATCH=$(echo $CURRENT | cut -d. -f3)
NEW_CHART_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
sed -i "s/^version:.*/version: ${NEW_CHART_VERSION}/" charts/logtide/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${APP_VERSION}\"/" charts/logtide/Chart.yaml
echo "chart: ${CURRENT} → ${NEW_CHART_VERSION}"
echo "appVersion: ${APP_VERSION}"
echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push
if: steps.bump.outputs.changed == 'true'
run: |
git add charts/logtide/Chart.yaml
git commit -m "bump to logtide v${{ github.event.client_payload.version }}"
git push origin main
- name: Trigger release workflow
if: steps.bump.outputs.changed == 'true'
run: gh workflow run release.yaml --ref main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}