Skip to content

.github/workflows/cron-update.yml #645

.github/workflows/cron-update.yml

.github/workflows/cron-update.yml #645

Workflow file for this run

on:
schedule:
- cron: "10 23 * * *"
workflow_dispatch:
watch:
types: [started]
jobs:
sync_tailscale:
runs-on: ubuntu-latest
steps:
- name: Get Latest Tailscale
id: get_latest_version
run: |
echo ${{ github.event.repository.full_name }}
repo_latest=$(curl https://api.github.com/repos/${{ github.event.repository.full_name }}/releases | jq -r '.[0].tag_name')
tailscale_latest=$(curl https://api.github.com/repos/tailscale/tailscale/releases | jq '.[0]')
version=$(echo $tailscale_latest | jq -r '.tag_name')
if [ $repo_latest == $version ]; then
echo "Tailscale no update."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "html_url=$(echo $tailscale_latest | jq -r '.html_url')" >> "$GITHUB_OUTPUT"
outputs:
version: ${{ steps.get_latest_version.outputs.version }}
html_url: ${{ steps.get_latest_version.outputs.html_url }}
build_tailscale:
runs-on: ubuntu-latest
needs: sync_tailscale
permissions:
contents: write
steps:
- run: curl -L -o ./tailscale.tar.gz https://github.com/tailscale/tailscale/archive/refs/tags/${{ needs.sync_tailscale.outputs.version }}.tar.gz
- run: tar -zxf tailscale.tar.gz
- name: Build
run: |
cd "tailscale-$(echo ${{ needs.sync_tailscale.outputs.version }} | awk '{print substr($0,2,99)}')"
git init && git add . && git -c user.name='Wayne' -c user.email='wayne@ms.live' commit -m 'init'
GOOS=linux GOARCH=arm64 sh build_dist.sh --box --extra-small -o tailscale ./cmd/tailscaled
upx --lzma --best ./tailscale
tar -zcf ../tailscale_${{ needs.sync_tailscale.outputs.version }}_arm64_upx.tar.gz ./tailscale
- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.sync_tailscale.outputs.version }}
name: ${{ needs.sync_tailscale.outputs.version }}
body: 版本 [${{ needs.sync_tailscale.outputs.version }}](${{ needs.sync_tailscale.outputs.html_url }}) 已从上游同步
draft: false
prerelease: false
files: tailscale_${{ needs.sync_tailscale.outputs.version }}_arm64_upx.tar.gz