ci: Bump nightly tag on scheduled Nightly builds (#18134)

This PR makes it so after a scheduled Nightly build we also update the
`nightly` tag to keep things in sync.

It's safe to bump the tag within this Action, as it won't trigger
another Nightly build due to GitHub's recursive Action protections:

> When you use the repository's `GITHUB_TOKEN` to perform tasks, events
triggered by the `GITHUB_TOKEN`, with the exception of
`workflow_dispatch` and `repository_dispatch`, will not create a new
workflow run. This prevents you from accidentally creating recursive
workflow runs. For example, if a workflow run pushes code using the
repository's `GITHUB_TOKEN`, a new workflow will not run even when the
repository contains a workflow configured to run when `push` events
occur.
>
> —
[source](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow)

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-09-20 08:46:23 -04:00 committed by GitHub
parent 90a12f5564
commit 16d2afc662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,3 +171,28 @@ jobs:
- name: Upload Zed Nightly
run: script/upload-nightly linux-targz
update-nightly-tag:
name: Update nightly tag
if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-latest
needs:
- bundle-mac
- bundle-linux-x86
- bundle-linux-arm
steps:
- name: Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Update nightly tag
run: |
if [ "$(git rev-parse nightly)" = "$(git rev-parse HEAD)" ]; then
echo "Nightly tag already points to current commit. Skipping tagging."
exit 0
fi
git config user.name github-actions
git config user.email github-actions@github.com
git tag -f nightly
git push origin nightly --force