-
Notifications
You must be signed in to change notification settings - Fork 12
143 lines (127 loc) · 5.1 KB
/
release.yml
File metadata and controls
143 lines (127 loc) · 5.1 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Release workflow for PyChunkedGraph with automatic helm chart updates
name: publish release
on:
workflow_dispatch:
inputs:
part:
description: "Semver part to bump (major, minor, patch)"
type: choice
required: true
default: "patch"
options: ["major", "minor", "patch"]
dry-run:
description: "Dry run"
type: boolean
required: true
default: false
skip-tests:
description: "Skip tests"
type: boolean
required: true
default: false
jobs:
bump:
name: Bump version
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
VERSION: ${{ steps.get-version.outputs.VERSION }}
SHORT_VERSION: ${{ steps.get-version.outputs.SHORT_VERSION }}
MAJOR_VERSION: ${{ steps.get-version.outputs.MAJOR_VERSION }}
MINOR_VERSION: ${{ steps.get-version.outputs.MINOR_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get tags
run: git fetch --tags origin
- name: Configure git for github-actions[bot]
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install bumpversion
run: pip install bumpversion
- name: Bump version with bumpversion
run: |
bumpversion ${{ github.event.inputs.part }}
- name: Commit and push with tags
if: ${{ github.event.inputs.dry-run == 'false' }}
run: git push --follow-tags
- name: Get version
id: get-version
run: |
version="$(git describe --tags)"
# remove the leading v from version
version="${version:1}"
echo "VERSION=$version" >> $GITHUB_OUTPUT
major_version="$(cut -d '.' -f 1 <<< $version)"
echo "MAJOR_VERSION=$major_version" >> $GITHUB_OUTPUT
minor_version="$(cut -d '.' -f 2 <<< $version)"
echo "MINOR_VERSION=$minor_version" >> $GITHUB_OUTPUT
short_version="$major_version.$minor_version"
echo "SHORT_VERSION=$short_version" >> $GITHUB_OUTPUT
- name: Show short version
run: echo ${{ steps.get-version.outputs.SHORT_VERSION }}
- name: Create GitHub Release
if: ${{ github.event.inputs.dry-run == 'false' }}
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.get-version.outputs.VERSION }}
name: Release v${{ steps.get-version.outputs.VERSION }}
body: |
## PyChunkedGraph v${{ steps.get-version.outputs.VERSION }}
This release was automatically generated by the release workflow.
### Changes
- Version bumped from previous release
See commit history for detailed changes.
draft: false
prerelease: false
update-chart:
name: Update pychunkedgraph Helm chart
runs-on: ubuntu-latest
needs: bump
if: ${{ github.event.inputs.dry-run == 'false' }}
permissions:
contents: read
id-token: write
steps:
- name: Checkout PyChunkedGraph repo
uses: actions/checkout@v4
- name: Checkout cave-helm-charts repo
uses: actions/checkout@v4
with:
repository: CAVEconnectome/cave-helm-charts
token: ${{ secrets.HELM_CHART_UPDATE_TOKEN }}
path: helm-charts
- name: Update Chart.yaml appVersion
id: update-chart
run: |
cd helm-charts
chart_file="charts/pychunkedgraph/Chart.yaml"
# Get current chart version
current_chart_version=$(grep '^version:' $chart_file | cut -d' ' -f2)
echo "Current chart version: $current_chart_version"
# Update appVersion
sed -i "s/^appVersion: .*/appVersion: \"${{ needs.bump.outputs.VERSION }}\"/" $chart_file
# Bump chart patch version
new_chart_version=$(echo $current_chart_version | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
sed -i "s/^version: .*/version: $new_chart_version/" $chart_file
echo "Updated to chart version: $new_chart_version"
echo "Updated to app version: ${{ needs.bump.outputs.VERSION }}"
echo "CHART_VERSION=$new_chart_version" >> $GITHUB_OUTPUT
- name: Commit and push changes
run: |
cd helm-charts
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add charts/pychunkedgraph/Chart.yaml
git commit -m "Update pychunkedgraph to v${{ needs.bump.outputs.VERSION }}
- Update appVersion to ${{ needs.bump.outputs.VERSION }}
- Bump chart version to ${{ steps.update-chart.outputs.CHART_VERSION }}
Auto-generated by PyChunkedGraph release workflow"
git push