mihomo/.github/workflows/prerelease.yml

106 lines
2.7 KiB
YAML
Raw Normal View History

2022-05-02 01:14:30 +08:00
name: Prerelease
2022-05-02 00:59:41 +08:00
on:
2022-11-26 20:11:43 +08:00
workflow_dispatch:
2022-05-02 00:59:41 +08:00
push:
branches:
2022-05-02 01:14:30 +08:00
- Alpha
2022-05-02 00:59:41 +08:00
- Beta
pull_request:
branches:
2022-05-02 01:14:30 +08:00
- Alpha
2022-05-02 00:59:41 +08:00
- Beta
jobs:
Build-Prerelease:
permissions: write-all
runs-on: ubuntu-22.04
2022-05-02 00:59:41 +08:00
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set variables
if: ${{ github.ref_name }} == Alpha
run: echo "VERSION=master" >> $GITHUB_ENV
shell: bash
- name: Set variables
if: ${{ github.ref_name }} == Beta
run: echo "VERSION=alpha" >> $GITHUB_ENV
shell: bash
- name: Set ENV
run: |
echo "NAME=clash.meta" >> $GITHUB_ENV
echo "BUILD_TIME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "TARGET=windows/*,linux/*,darwin-10.16/*" >> $GITHUB_ENV
echo "TAGS=with_gvisor,with_lwip" >> $GITHUB_ENV
echo "ShortSHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
echo "$ShortSHA"
echo "$REPO"
shell: bash
2022-11-02 22:13:54 +08:00
- name: Setup Go
uses: actions/setup-go@v3
2022-05-02 00:59:41 +08:00
with:
2022-11-02 22:13:54 +08:00
go-version: '1.19'
check-latest: true
cache: true
2022-05-02 01:14:30 +08:00
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
add-to-path: false
- name: Go Test
2022-05-02 08:27:17 +08:00
if: ${{github.ref_name=='Beta'}}
2022-05-02 00:59:41 +08:00
run: |
go test ./...
2022-05-02 01:14:30 +08:00
- name: Set up xgo
run: |
docker pull techknowlogick/xgo:latest
go install src.techknowlogick.com/xgo@latest
2022-05-02 00:59:41 +08:00
- name: Build
if: success()
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
mkdir bin
make android-arm64
make xgoall
cp release.sh ./bin/
cd bin
ls -la
chmod +x *
bash ./release.sh
rm ./release.sh
ls -la
cd ..
2022-05-02 00:59:41 +08:00
- name: Delete current release assets
2023-01-11 00:50:04 +08:00
uses: andreaswilli/delete-release-assets-action@v2.0.0
2022-05-02 00:59:41 +08:00
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2023-01-11 00:50:04 +08:00
tag: Prerelease-${{ github.ref_name }}
deleteOnlyFromDrafts: false
2022-05-02 00:59:41 +08:00
- name: Tag Repo
2023-01-11 00:50:04 +08:00
uses: richardsimko/update-tag@v1
2022-05-02 00:59:41 +08:00
with:
2022-05-02 08:27:17 +08:00
tag_name: Prerelease-${{ github.ref_name }}
2022-05-02 00:59:41 +08:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Alpha
uses: softprops/action-gh-release@v1
if: ${{ success() }}
with:
2023-01-11 00:50:04 +08:00
tag: ${{ github.ref_name }}
2022-05-02 08:27:17 +08:00
tag_name: Prerelease-${{ github.ref_name }}
2022-05-02 00:59:41 +08:00
files: bin/*
prerelease: true
generate_release_notes: true