Update ci
This commit is contained in:
153
.github/workflows/ci.yml
vendored
153
.github/workflows/ci.yml
vendored
@@ -1,16 +1,24 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main","temp" ]
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'docs/**'
|
||||||
|
- '.github/**'
|
||||||
|
- '!.github/workflows/ci.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches:
|
||||||
permissions: write-all
|
- main
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.ref }}-${{ github.workflow }}
|
group: ${{ github.ref }}-${{ github.workflow }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
permissions: write-all
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -28,18 +36,10 @@ jobs:
|
|||||||
aarch: amd64
|
aarch: amd64
|
||||||
targets: exe
|
targets: exe
|
||||||
|
|
||||||
# Flutter does not support x86
|
- platform: linux
|
||||||
# - platform: windows
|
os: ubuntu-latest
|
||||||
# os: windows-latest
|
aarch: amd64
|
||||||
# aarch: 386
|
targets: AppImage
|
||||||
# targets: exe
|
|
||||||
# target: windows-x86
|
|
||||||
|
|
||||||
# Flutter does not support x86
|
|
||||||
# - platform: linux
|
|
||||||
# os: ubuntu-latest
|
|
||||||
# aarch: 386
|
|
||||||
# targets: AppImage
|
|
||||||
|
|
||||||
- platform: macos
|
- platform: macos
|
||||||
os: macos-11
|
os: macos-11
|
||||||
@@ -51,12 +51,6 @@ jobs:
|
|||||||
# aarch: universal
|
# aarch: universal
|
||||||
# targets: ipa
|
# targets: ipa
|
||||||
|
|
||||||
- platform: linux
|
|
||||||
os: ubuntu-latest
|
|
||||||
aarch: amd64
|
|
||||||
targets: AppImage
|
|
||||||
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
@@ -79,22 +73,22 @@ jobs:
|
|||||||
- name: Setup Flutter
|
- name: Setup Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
# flutter-version: '3.13.x'
|
flutter-version: '3.13.x'
|
||||||
channel: 'stable'
|
channel: 'stable'
|
||||||
# cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Build macos dmg
|
|
||||||
if: matrix.platform == 'macos' || matrix.platform == 'ios'
|
|
||||||
run: |
|
|
||||||
brew install create-dmg tree node
|
|
||||||
npm install -g appdmg
|
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
if: startsWith(matrix.platform,'android')
|
if: startsWith(matrix.platform,'android')
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: 'zulu'
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
|
||||||
|
- name: Setup Flutter Distributor
|
||||||
|
if: ${{ !startsWith(matrix.platform,'android') }}
|
||||||
|
run: |
|
||||||
|
dart pub global activate flutter_distributor
|
||||||
|
|
||||||
- name: Setup Linux dependencies
|
- name: Setup Linux dependencies
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
run: |
|
run: |
|
||||||
@@ -104,11 +98,11 @@ jobs:
|
|||||||
chmod +x appimagetool
|
chmod +x appimagetool
|
||||||
mv appimagetool /usr/local/bin/
|
mv appimagetool /usr/local/bin/
|
||||||
|
|
||||||
- name: Setup Flutter Distributor
|
- name: Build macos dmg
|
||||||
if: ${{ !startsWith(matrix.platform,'android') }}
|
if: matrix.platform == 'macos' || matrix.platform == 'ios'
|
||||||
# shell: powershell
|
|
||||||
run: |
|
run: |
|
||||||
dart pub global activate flutter_distributor
|
brew install create-dmg tree node
|
||||||
|
npm install -g appdmg
|
||||||
|
|
||||||
- name: Get Geo Assets
|
- name: Get Geo Assets
|
||||||
run: |
|
run: |
|
||||||
@@ -127,7 +121,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make ${{ matrix.platform }}-libs
|
make ${{ matrix.platform }}-libs
|
||||||
|
|
||||||
- name: Signing properties
|
- name: Setup Signing Properties
|
||||||
env:
|
env:
|
||||||
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
|
ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
|
||||||
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
|
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
|
||||||
@@ -145,11 +139,12 @@ jobs:
|
|||||||
cp release.* app/
|
cp release.* app/
|
||||||
cat release.properties
|
cat release.properties
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Release ${{ matrix.platform }}
|
- name: Release ${{ matrix.platform }}
|
||||||
run: |
|
run: |
|
||||||
make ${{ matrix.platform }}-release
|
make ${{ matrix.platform }}-release
|
||||||
|
|
||||||
- name: Copy to out WINDOWS
|
- name: Copy to out Windows
|
||||||
if: matrix.platform == 'windows'
|
if: matrix.platform == 'windows'
|
||||||
run: |
|
run: |
|
||||||
New-Item -ItemType Directory -Force -Name "out"
|
New-Item -ItemType Directory -Force -Name "out"
|
||||||
@@ -160,10 +155,10 @@ jobs:
|
|||||||
move out\*setup.$EXT out\hiddify-${{ matrix.platform }}-x64-setup.$EXT
|
move out\*setup.$EXT out\hiddify-${{ matrix.platform }}-x64-setup.$EXT
|
||||||
Get-ChildItem -Recurse -File -Filter "*.$EXT"
|
Get-ChildItem -Recurse -File -Filter "*.$EXT"
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir HiddifyNext-portable
|
mkdir HiddifyNext-portable
|
||||||
xcopy /s /v D:\a\hiddify-next\hiddify-next\build\windows\runner\Release\ .\HiddifyNext-portable\
|
xcopy /s /v D:\a\hiddify-next\hiddify-next\build\windows\runner\Release\ .\HiddifyNext-portable\
|
||||||
Compress-Archive HiddifyNext-portable out\hiddify-${{ matrix.platform }}-x64-portable.zip
|
Compress-Archive HiddifyNext-portable out\hiddify-${{ matrix.platform }}-x64-portable.zip
|
||||||
|
|
||||||
- name: Copy to out Android
|
- name: Copy to out Android
|
||||||
if: matrix.platform == 'android'
|
if: matrix.platform == 'android'
|
||||||
run: |
|
run: |
|
||||||
@@ -175,10 +170,6 @@ jobs:
|
|||||||
mv ./build/app/outputs/flutter-apk/app-release.apk out/hiddify-android-universal.apk || echo "no universal apk"
|
mv ./build/app/outputs/flutter-apk/app-release.apk out/hiddify-android-universal.apk || echo "no universal apk"
|
||||||
cp ./build/app/outputs/bundle/release/app-release.aab out/bundle.aab
|
cp ./build/app/outputs/bundle/release/app-release.aab out/bundle.aab
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Copy to out unix
|
- name: Copy to out unix
|
||||||
if: matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'ios'
|
if: matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'ios'
|
||||||
run: |
|
run: |
|
||||||
@@ -190,33 +181,17 @@ jobs:
|
|||||||
# Find all files with this extension in SRC_DIR, and copy them to DST_DIR
|
# Find all files with this extension in SRC_DIR, and copy them to DST_DIR
|
||||||
find "." -type f -name "*.$EXT" -exec cp {} "out" \;
|
find "." -type f -name "*.$EXT" -exec cp {} "out" \;
|
||||||
done
|
done
|
||||||
# mv out/*arm64-v8a*.apk out/hiddify-android-arm64.apk || echo "no arm64 apk"
|
|
||||||
# mv out/*armeabi-v7a*.apk out/hiddify-android-arm7.apk || echo "no arm7 apk"
|
|
||||||
# mv out/*x86_64*.apk out/hiddify-android-x86_64.apk || echo "no x64 apk"
|
|
||||||
# mv out/*universal*.apk out/hiddify-android-universal.apk || echo "no universal apk"
|
|
||||||
#rm out/app-release.apk ||echo "no app-release.apk"
|
|
||||||
#mv out/*.aab out/hiddify-android-playstore.aab || echo "no aab"
|
|
||||||
mv out/*.AppImage out/hiddify-linux-x64.AppImage || echo "no app image"
|
mv out/*.AppImage out/hiddify-linux-x64.AppImage || echo "no app image"
|
||||||
(cd out&& chmod +x hiddify-linux-x64.AppImage && 7z a hiddify-linux-x64.AppImage.zip hiddify-linux-x64.AppImage)||echo "no app image"
|
(cd out&& chmod +x hiddify-linux-x64.AppImage && 7z a hiddify-linux-x64.AppImage.zip hiddify-linux-x64.AppImage)||echo "no app image"
|
||||||
mv out/*.dmg out/hiddify-macos-universal.dmg || echo "no macos dmg"
|
mv out/*.dmg out/hiddify-macos-universal.dmg || echo "no macos dmg"
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}
|
name: ${{ matrix.platform }}
|
||||||
path: ./out
|
path: ./out
|
||||||
retention-days: 2
|
retention-days: 2
|
||||||
|
|
||||||
- name: Create or Update Draft Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
files: ./out/*
|
|
||||||
name: "draft"
|
|
||||||
tag_name: "draft"
|
|
||||||
prerelease: true
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
# - name: Create service_account.json
|
# - name: Create service_account.json
|
||||||
# if: matrix.platform == 'android'
|
# if: matrix.platform == 'android'
|
||||||
# run: echo '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}' > service_account.json
|
# run: echo '${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}' > service_account.json
|
||||||
@@ -230,3 +205,61 @@ jobs:
|
|||||||
# releaseName: ${{ github.ref }}
|
# releaseName: ${{ github.ref }}
|
||||||
# releaseFiles: ./build/app/outputs/bundle/release/app-release.aab
|
# releaseFiles: ./build/app/outputs/bundle/release/app-release.aab
|
||||||
# track: internal
|
# track: internal
|
||||||
|
|
||||||
|
upload-prerelease:
|
||||||
|
permissions: write-all
|
||||||
|
if: ${{ github.ref_type=='branch' }}
|
||||||
|
needs: [build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: ./out/
|
||||||
|
|
||||||
|
- name: Display Files Structure
|
||||||
|
run: ls -R
|
||||||
|
working-directory: ./out
|
||||||
|
|
||||||
|
- name: Delete Current Release Assets
|
||||||
|
uses: 8Mi-Tech/delete-release-assets-action@main
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: 'draft'
|
||||||
|
deleteOnlyFromDrafts: false
|
||||||
|
|
||||||
|
- name: Create or Update Draft Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: ${{ success() }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
files: ./out/*
|
||||||
|
name: 'draft'
|
||||||
|
tag_name: 'draft'
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
|
upload-release:
|
||||||
|
permissions: write-all
|
||||||
|
if: ${{ github.ref_type=='tag' }}
|
||||||
|
needs: [build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: ./out/
|
||||||
|
|
||||||
|
- name: Display Files Structure
|
||||||
|
run: ls -R
|
||||||
|
working-directory: ./out
|
||||||
|
|
||||||
|
- name: Upload Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: ${{ success() }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
files: ./out/*
|
||||||
|
|||||||
10
.prettierrc
Normal file
10
.prettierrc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ".github/**",
|
||||||
|
"options": {
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
15
Makefile
15
Makefile
@@ -5,9 +5,12 @@ ANDROID_OUT=./android/app/libs
|
|||||||
DESKTOP_OUT=./libcore/bin
|
DESKTOP_OUT=./libcore/bin
|
||||||
GEO_ASSETS_DIR=./assets/core
|
GEO_ASSETS_DIR=./assets/core
|
||||||
|
|
||||||
|
BRANCH=$(shell git branch --show-current)
|
||||||
|
VERSION=$(shell git describe --tags --abbrev=0 || echo "unknown version")
|
||||||
|
|
||||||
CORE_NAME=hiddify-libcore
|
CORE_NAME=hiddify-libcore
|
||||||
CORE_VERSION=v$(core.version)
|
CORE_VERSION=v$(core.version)
|
||||||
LIBS_DOWNLOAD_URL=https://github.com/hiddify/hiddify-next-core/releases/download/$(CORE_VERSION)
|
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/$(CORE_VERSION)
|
||||||
|
|
||||||
get:
|
get:
|
||||||
flutter pub get
|
flutter pub get
|
||||||
@@ -39,23 +42,23 @@ ios-release: #not tested
|
|||||||
|
|
||||||
android-libs:
|
android-libs:
|
||||||
mkdir -p $(ANDROID_OUT)
|
mkdir -p $(ANDROID_OUT)
|
||||||
curl -L $(LIBS_DOWNLOAD_URL)/$(CORE_NAME)-android-$(CORE_VERSION).aar.gz | gunzip > $(ANDROID_OUT)/libcore.aar
|
curl -L $(CORE_URL)/$(CORE_NAME)-android-$(CORE_VERSION).aar.gz | gunzip > $(ANDROID_OUT)/libcore.aar
|
||||||
|
|
||||||
windows-libs:
|
windows-libs:
|
||||||
mkdir -p $(DESKTOP_OUT)
|
mkdir -p $(DESKTOP_OUT)
|
||||||
curl -L $(LIBS_DOWNLOAD_URL)/$(CORE_NAME)-windows-amd64-$(CORE_VERSION).dll.gz | gunzip > $(DESKTOP_OUT)/libcore.dll
|
curl -L $(CORE_URL)/$(CORE_NAME)-windows-amd64-$(CORE_VERSION).dll.gz | gunzip > $(DESKTOP_OUT)/libcore.dll
|
||||||
|
|
||||||
linux-libs:
|
linux-libs:
|
||||||
mkdir -p $(DESKTOP_OUT)
|
mkdir -p $(DESKTOP_OUT)
|
||||||
curl -L $(LIBS_DOWNLOAD_URL)/$(CORE_NAME)-linux-amd64-$(CORE_VERSION).so.gz | gunzip > $(DESKTOP_OUT)/libcore.so
|
curl -L $(CORE_URL)/$(CORE_NAME)-linux-amd64-$(CORE_VERSION).so.gz | gunzip > $(DESKTOP_OUT)/libcore.so
|
||||||
|
|
||||||
macos-libs:
|
macos-libs:
|
||||||
mkdir -p $(DESKTOP_OUT)/ &&\
|
mkdir -p $(DESKTOP_OUT)/ &&\
|
||||||
curl -L $(LIBS_DOWNLOAD_URL)/$(CORE_NAME)-macos-universal-$(CORE_VERSION).dylib.gz | gunzip > $(DESKTOP_OUT)/libcore.dylib
|
curl -L $(CORE_URL)/$(CORE_NAME)-macos-universal-$(CORE_VERSION).dylib.gz | gunzip > $(DESKTOP_OUT)/libcore.dylib
|
||||||
|
|
||||||
ios-libs: #not tested
|
ios-libs: #not tested
|
||||||
mkdir -p $(DESKTOP_OUT)/ &&\
|
mkdir -p $(DESKTOP_OUT)/ &&\
|
||||||
curl -L $(LIBS_DOWNLOAD_URL)/$(CORE_NAME)-ios-universal-$(CORE_VERSION).xcframework.gz | gunzip > $(DESKTOP_OUT)/libcore.xcframework
|
curl -L $(CORE_URL)/$(CORE_NAME)-ios-universal-$(CORE_VERSION).xcframework.gz | gunzip > $(DESKTOP_OUT)/libcore.xcframework
|
||||||
|
|
||||||
get-geo-assets:
|
get-geo-assets:
|
||||||
curl -L https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db -o $(GEO_ASSETS_DIR)/geoip.db
|
curl -L https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db -o $(GEO_ASSETS_DIR)/geoip.db
|
||||||
|
|||||||
Reference in New Issue
Block a user