Skip to content

Update Tailscale

Update Tailscale #373

name: Update Tailscale
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update_tailscale:
runs-on: ubuntu-latest
steps:
- name: Checkout main repository
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Update
run: |
OLD_SHA=$(git -C third_party/tailscale rev-parse --short HEAD)
echo "Tailscale before update: $OLD_SHA"
git submodule update --remote --recursive third_party/tailscale
NEW_SHA=$(git -C third_party/tailscale rev-parse --short main)
echo "Tailscale after update: $NEW_SHA"
if git diff --exit-code; then
FLAG=0
echo "No submodule changes; Restore FLAG."
git config --global user.name "gitbot"
git config --global user.email "bot@noreply.github.com"
git tag -f -a derper-changed -m "$FLAG"
git push -f origin refs/tags/derper-changed
exit 0
fi
git config --global user.name "gitbot"
git config --global user.email "bot@noreply.github.com"
git commit -am "Update tailscale to $NEW_SHA"
git push origin "${{ github.ref_name }}"
if git -C third_party/tailscale diff --exit-code "$OLD_SHA" "$NEW_SHA" -- cmd/derper; then
FLAG=0
else
FLAG=1
fi
echo "Derper changed? $FLAG"
git tag -f -a derper-changed -m "$FLAG"
git push -f origin refs/tags/derper-changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}