Zig Update #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zig Update | |
on: | |
schedule: | |
- cron: 0 0 * * 1 | |
workflow_dispatch: | |
jobs: | |
update: | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update | |
env: | |
GH_TOKEN: ${{ github.token }} | |
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)" | |
BRANCH="zig-update-$NEW_VERSION" | |
git switch -c "$BRANCH" | |
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 config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -m 'update Zig versions' | |
git push -u origin "$BRANCH" | |
gh pr create \ | |
--title "chore: update Zig versions up to $NEW_VERSION" \ | |
--body "- [ ] Check that the automatic version replacements make sense." | |
} |