Change build setup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: CI & Build
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -9,13 +9,15 @@ on:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- '.github/**'
|
||||
- '!.github/workflows/ci.yml'
|
||||
- '!.github/workflows/build.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
env:
|
||||
CHANNEL: ${{ github.ref_type == 'tag' && endsWith(github.ref_name, 'dev') && 'dev' || github.ref_type != 'tag' && 'dev' || 'prod' }}
|
||||
jobs:
|
||||
build:
|
||||
permissions: write-all
|
||||
@@ -56,20 +58,6 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: Cache Flutter dependencies
|
||||
# uses: actions/cache@v3
|
||||
# with:
|
||||
# path: |
|
||||
# ~/.pub-cache
|
||||
# ~/.gradle/caches
|
||||
# ~/.gradle/wrapper
|
||||
# ~/.npm
|
||||
# ~/.cache
|
||||
# ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-pub-cache-
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
@@ -118,8 +106,6 @@ jobs:
|
||||
make gen
|
||||
|
||||
- name: Get Libs ${{ matrix.platform }}
|
||||
env:
|
||||
BRANCH: ${{ github.ref_type == 'tag' && 'RELEASE' || 'DEVELOP' }}
|
||||
run: |
|
||||
make ${{ matrix.platform }}-libs
|
||||
|
||||
@@ -145,12 +131,12 @@ jobs:
|
||||
|
||||
- name: Release ${{ matrix.platform }}
|
||||
env:
|
||||
BRANCH: ${{ github.ref_type == 'tag' && 'RELEASE' || 'DEVELOP' }}
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
run: |
|
||||
make ${{ matrix.platform }}-release
|
||||
|
||||
- name: Upload Debug Symbols
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
env:
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||
@@ -215,7 +201,7 @@ jobs:
|
||||
|
||||
upload-draft:
|
||||
permissions: write-all
|
||||
if: ${{ github.ref_type=='branch' }}
|
||||
if: ${{ github.ref_type == 'branch' }}
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -238,8 +224,7 @@ jobs:
|
||||
|
||||
- name: Create or Update Draft Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: github.ref_type != 'tag'
|
||||
#&& success()
|
||||
if: ${{ github.ref_type != 'tag' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
@@ -250,7 +235,7 @@ jobs:
|
||||
|
||||
upload-release:
|
||||
permissions: write-all
|
||||
if: ${{ github.ref_type=='tag' }}
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
needs: [build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -269,7 +254,7 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
prerelease: ${{ contains(github.ref_name,'dev') }}
|
||||
prerelease: ${{ CHANNEL == 'dev' }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: ./out/*
|
||||
|
||||
251
.github/workflows/release.yml
vendored
251
.github/workflows/release.yml
vendored
@@ -1,251 +0,0 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# release:
|
||||
# types: [ published ]
|
||||
# workflow_run:
|
||||
# workflows: ["build"]
|
||||
# types:
|
||||
# - completed
|
||||
jobs:
|
||||
get-release:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tag_name: ${{ steps.get-release.outputs.tag_name }}
|
||||
upload_url: ${{ steps.get-release.outputs.upload_url }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: thebritican/fetch-latest-release@v2.0.0
|
||||
id: get-release
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
needs: [ get-release ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.20"
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.10.2'
|
||||
channel: 'stable'
|
||||
- name: Build
|
||||
env:
|
||||
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||
run: |
|
||||
cd core
|
||||
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dll mapleafgo.cn/clash_for_flutter/core
|
||||
cd ../
|
||||
|
||||
dart pub global activate flutter_distributor
|
||||
flutter_distributor package --platform=windows --targets=exe
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android
|
||||
path: dist/*/*
|
||||
retention-days: 2
|
||||
- name: Upload
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||
asset_path: dist/*/*
|
||||
overwrite: true
|
||||
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ get-release ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4.0.1
|
||||
with:
|
||||
go-version: "^1.20"
|
||||
- name: Set up MinGW
|
||||
uses: egor-tensin/setup-mingw@v2
|
||||
with:
|
||||
platform: x64
|
||||
|
||||
- name: Setup Java
|
||||
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: 11
|
||||
|
||||
- name: Setup Android SDK
|
||||
if: matrix.platform == 'android'
|
||||
uses: android-actions/setup-android@v2
|
||||
|
||||
- name: Get Dependencies
|
||||
run: |
|
||||
flutter pub get
|
||||
|
||||
- name: Generate
|
||||
run: |
|
||||
dart run build_runner build --delete-conflicting-outputs
|
||||
dart run slang
|
||||
|
||||
|
||||
- name: Generate Libs Android
|
||||
run: |
|
||||
make android-libs
|
||||
|
||||
- name: Release Android
|
||||
run: |
|
||||
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
|
||||
|
||||
- name: Copy to out
|
||||
run: |
|
||||
mkdir out
|
||||
IFS=',' read -r -a EXT_ARRAY <<< "${{ matrix.targets }}"
|
||||
|
||||
# Loop over extensions
|
||||
for EXT in "${EXT_ARRAY[@]}"; do
|
||||
# Find all files with this extension in SRC_DIR, and copy them to DST_DIR
|
||||
find "." -type f -name "*.$EXT" -exec cp {} "out" \;
|
||||
done
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android
|
||||
path: ./out
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||
asset_path: out/*
|
||||
overwrite: true
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [ get-release ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.20"
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.10.2'
|
||||
channel: 'stable'
|
||||
- run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y locate ninja-build libgtk-3-dev libayatana-appindicator3-dev libnotify-dev \
|
||||
binutils coreutils desktop-file-utils fakeroot fuse libgdk-pixbuf2.0-dev patchelf python3-pip python3-setuptools squashfs-tools strace util-linux zsync
|
||||
- name: Build
|
||||
env:
|
||||
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||
run: |
|
||||
curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o /usr/local/bin/appimagetool
|
||||
chmod +x /usr/local/bin/appimagetool
|
||||
|
||||
cd core
|
||||
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.so mapleafgo.cn/clash_for_flutter/core
|
||||
cd ../
|
||||
|
||||
dart pub global activate flutter_distributor
|
||||
flutter_distributor package --platform=linux --targets=appimage,zip
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: linux
|
||||
path: dist/*/*
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||
asset_path: dist/*/*
|
||||
overwrite: true
|
||||
|
||||
|
||||
build-macos-arm64-lib:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ get-release ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.20"
|
||||
- run: mkdir -p ~/image-cache
|
||||
- id: image-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/image-cache
|
||||
key: image-cache-xgo-v1.20
|
||||
- if: steps.image-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
docker pull techknowlogick/xgo:go-1.20.x
|
||||
docker save -o ~/image-cache/xgo.tar techknowlogick/xgo:go-1.20.x
|
||||
- if: steps.image-cache.outputs.cache-hit == 'true'
|
||||
run: docker load -i ~/image-cache/xgo.tar
|
||||
- name: Build
|
||||
run: |
|
||||
cd core
|
||||
go install src.techknowlogick.com/xgo@latest
|
||||
xgo --targets=darwin/arm64 -ldflags="-w -s" -buildmode=c-shared -out=libclash .
|
||||
mv libclash-*.dylib libclash.dylib
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: macos-arm64-lib
|
||||
path: core/libclash.dylib
|
||||
retention-days: 2
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
needs: [ get-release, build-macos-arm64-lib ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "^1.20"
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.10.2'
|
||||
channel: 'stable'
|
||||
- name: Install appdmg
|
||||
run: npm install -g appdmg
|
||||
- name: Mkdir Frameworks
|
||||
run: mkdir -p macos/Frameworks
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: macos-arm64-lib
|
||||
path: macos/Frameworks
|
||||
- name: Build
|
||||
env:
|
||||
VERSION: ${{ needs.get-release.outputs.tag_name }}
|
||||
run: |
|
||||
PROJECT_DIR=$(pwd)
|
||||
|
||||
dart pub global activate flutter_distributor
|
||||
|
||||
flutter_distributor package --platform=macos --targets=dmg
|
||||
mv dist/$VERSION/*-macos.dmg dist/$VERSION/macos-arm64.dmg
|
||||
|
||||
cd $PROJECT_DIR/core
|
||||
go build -ldflags="-w -s" -buildmode=c-shared -o ./dist/libclash.dylib mapleafgo.cn/clash_for_flutter/core
|
||||
cp -f ./dist/libclash.dylib $PROJECT_DIR/macos/Frameworks/libclash.dylib
|
||||
cd $PROJECT_DIR
|
||||
|
||||
flutter_distributor package --platform=macos --targets=dmg
|
||||
mv dist/$VERSION/*-macos.dmg dist/$VERSION/macos-amd64.dmg
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: macos
|
||||
path: dist/*/*
|
||||
retention-days: 2
|
||||
- name: Upload
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ needs.get-release.outputs.upload_url }}
|
||||
asset_path: dist/*/*
|
||||
overwrite: true
|
||||
Reference in New Issue
Block a user