Skip to content

GitHub Actions Auto Builder CI #717

GitHub Actions Auto Builder CI

GitHub Actions Auto Builder CI #717

Workflow file for this run

name: GitHub Actions Auto Builder CI
env:
AARCH64: arm64
AMD64: amd64
X86_64: x86_64
env_file: .env
on:
push:
schedule:
- cron: '0 6 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: new_version
name: Early exit if no new version
run: export RELEASE_VERSION=$(curl --silent "https://api.github.com/repos/tailscale/tailscale/tags" | jq '.[] | select(.name | endswith("pre") | not)' | jq -r '.name' | head -n +1 | awk -Fv '{print $2}'); echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- run: export RELEASE_VERSION_CTP_ASUSTOR_TS=$(curl --silent "https://api.github.com/repos/charlieporth1/asustor-tailscale/tags" | jq -r '.[0].name'); echo "RELEASE_VERSION_CTP_ASUSTOR_TS=$RELEASE_VERSION_CTP_ASUSTOR_TS" >> $GITHUB_ENV
- id: checkout
if: steps.new_version.conclusion == 'success'
uses: actions/checkout@v3
name: Auto Builder
- run: sudo chown $USER:$USER -R .
- run: sudo chown $USER:$USER -R .
- run: sudo cp -rf apk/CONTROL/config.json.edit apk/CONTROL/config.json
- run: sudo sed -i "s|RELEASE_VERSION|$RELEASE_VERSION|g" apk/CONTROL/config.json
- run: sleep 5s
- run: echo "ARCH=amd64" >> $GITHUB_ENV
- run: sleep 5s
- run: sudo -E ./scripts/build.sh
- run: sudo -E ./scripts/apkg-tools_py3.py create apk
- run: sudo sed -i "s|x86_64|${{ env.AARCH64 }}|g" apk/CONTROL/config.json
- run: sleep 5s
- run: echo "ARCH=arm64" >> $GITHUB_ENV
- run: sleep 5s
- run: sudo -E ./scripts/build.sh
- run: sudo -E ./scripts/apkg-tools_py3.py create apk
- run: sudo cp -rf apk/CONTROL/config.json.edit apk/CONTROL/config.json
- id: commit
if: steps.new_version.conclusion == 'success'
run: sudo ls -R
- run: sudo git config --local user.name github-actions
- run: sudo git config --local user.email [email protected]
- run: sudo git filter-branch --force --index-filter "git rm --cached --ignore-unmatch tailscale_*_*" --prune-empty --tag-name-filter cat -- --all || exit 0
- run: sudo git gc --prune=now || exit 0
- run: sudo git gc --aggressive --prune=now || exit 0
- run: sudo git add .
- run: sudo git commit -m "Automatic Version Build from GitHub Action at `date` ${{ env.RELEASE_VERSION }}"
- run: sudo git tag -a ${{ env.RELEASE_VERSION }} -m "Automatic tag ${{ env.RELEASE_VERSION }}"
- run: sudo git push origin ${{ env.RELEASE_VERSION }}
- run: sudo git push origin HEAD:master
- id: upload
if: steps.new_version.conclusion == 'success'
uses: actions/upload-artifact@v3
with:
name: tailscale_${{ env.RELEASE_VERSION }}_${{ env.AARCH64 }}.apk
path: tailscale_${{ env.RELEASE_VERSION }}_${{ env.AARCH64 }}.apk
- uses: actions/upload-artifact@v3
with:
name: tailscale_${{ env.RELEASE_VERSION }}_${{ env.X86_64 }}.apk
path: tailscale_${{ env.RELEASE_VERSION }}_${{ env.X86_64 }}.apk
- id: release
if: steps.new_version.conclusion == 'success'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ env.RELEASE_VERSION }}
prerelease: true
title: "Automatic Release ${{ env.RELEASE_VERSION }}"
files: |
LICENSE.txt
*.apk