Auto Update Tailscale #127
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: Auto Update Tailscale | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
update_tailscale: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get tailscale version and update Dockerfile | |
run: | | |
current_version=$(head -n1 Dockerfile | sed -e "s/^ARG TSVERSION=//") | |
latest_version=$(curl https://pkgs.tailscale.com/stable/ | grep tailscale_ -m 1 | cut -d'_' -f 2) | |
if [ "$current_version" != "$latest_version" ]; then | |
sed -i "1 s/.*/ARG TSVERSION=$latest_version/" Dockerfile | |
fi | |
- name: Commit and Push | |
run: | | |
git config --global user.name "GitHub Action: auto update tailscale" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add Dockerfile | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "auto update tailscale version" | |
git push | |
fi |