Skip to content

Commit 00a086e

Browse files
committed
Automatically generate helm/changelog PR
1 parent 3fd305c commit 00a086e

1 file changed

Lines changed: 49 additions & 5 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ jobs:
7070
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
7171
ref: "master"
7272

73+
- name: Configure git
74+
run: |
75+
git config --global user.name cdrci
76+
git config --global user.email opensource@coder.com
77+
7378
- name: Fetch and reset master
7479
run: |
7580
git remote add upstream https://github.com/coder/code-server-aur.git
7681
git fetch upstream
7782
git reset --hard upstream/master
7883
git push --force
7984
80-
- name: Configure git
81-
run: |
82-
git config --global user.name cdrci
83-
git config --global user.email opensource@coder.com
84-
8585
- name: Validate package
8686
uses: heyhusen/archlinux-package-action@c9f94059ccbebe8710d31d582f33ef4e84fe575c # v3.0.0
8787
with:
@@ -136,3 +136,47 @@ jobs:
136136
out-file-path: "release-packages"
137137

138138
- run: npm run publish:docker
139+
140+
repo:
141+
runs-on: ubuntu-latest
142+
env:
143+
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
144+
TAG: ${{ inputs.version || github.ref_name }}
145+
needs: docker
146+
147+
steps:
148+
- name: Set version to tag without leading v
149+
run: |
150+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
151+
152+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
153+
154+
- name: Update Helm chart
155+
run: |
156+
current=$(yq .version ci/helm-chart/Chart.yaml)
157+
next=$(semver "$current" -i minor)
158+
echo "Bumping version from $current to $next..."
159+
sed -i.bak "s/^version: $current\$/version: $next/" ci/helm-chart/Chart.yaml
160+
161+
echo "Setting app version and image to $VERSION..."
162+
sed -i.bak "s/^appVersion: .\+\$/appVersion: $VERSION/" ci/helm-chart/Chart.yaml
163+
sed -i.bak "s/^ tag: .\+\$/ tag: '$VERSION'/" ci/helm-chart/values.yaml
164+
165+
- name: Update changelog
166+
run: |
167+
date=$(printf '%(%Y-%m-%d)T\n' -1)
168+
link="https://github.com/coder/code-server/releases/tag/v$VERSION"
169+
sed -i.bak "s|## Unreleased|## Unreleased\n\n## [$VERSION]($link) - $date|" CHANGELOG.md
170+
171+
- name: Open PR
172+
run: |
173+
git config --global user.name cdrci
174+
git config --global user.email opensource@coder.com
175+
git checkout -b "helm/$VERSION"
176+
git add .
177+
git commit -m "Update to $VERSION"
178+
git push -u origin "$(git branch --show)"
179+
gh pr create \
180+
--repo coder/code-server \
181+
--body "- [X] Update Helm chart\n- [ ] https://github.com/coder/code-server-aur/pulls" \
182+
--title "Update to $VERSION"

0 commit comments

Comments
 (0)