Skip to content

Commit

Permalink
Automatically replace the old version in code
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Nov 22, 2023
1 parent 514d873 commit 7712a74
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/zig_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ jobs:
uses: actions/checkout@v3
- name: Update
run: |
OLD_VERSION="$(grep -m 1 -oP '^\s+"\K\d+\.\d+\.\d+(?=":)' zig/private/versions.bzl)"
bazel run //util:update_zig_versions
[ -z "$(git status --porcelain=v1 zig/private/versions.bzl 2>/dev/null)" ] || {
NEW_VERSION="$(grep -m 1 -oP '^\s+"\K\d+\.\d+\.\d+(?=":)' zig/private/versions.bzl)"
git add zig/private/versions.bzl
readarray -t FILES < <(git grep -l -F "$OLD_VERSION" -- ':(exclude)zig/private/versions.bzl')
sed -i "s/${OLD_VERSION//./\\.}/$NEW_VERSION/g" "${FILES[@]}"
git add "${FILES[@]}"
git commit -m 'update Zig versions'
gh pr create \
--title "chore: update Zig versions up to $NEW_VERSION" \
--body "- [ ] Manually update references to the latest Zig version."
--body "- [ ] Check that the automatic version replacements make sense."
}

0 comments on commit 7712a74

Please sign in to comment.