Change workflows

This commit is contained in:
problematicconsumer
2024-01-13 14:48:56 +03:30
parent 251fa42fac
commit d5d26dd311
4 changed files with 86 additions and 101 deletions

View File

@@ -1,26 +1,26 @@
name: Build name: Build
on: on:
push: workflow_call:
branches: inputs:
- main upload-artifact:
tags: type: boolean
- 'v*' default: true
paths-ignore: tag-name:
- '**.md' type: string
- 'docs/**' default: "draft"
- '.github/**' channel:
- '!.github/workflows/build.yml' type: string
- 'appcast.xml' default: "dev"
# pull_request:
# branches:
# - main
concurrency: concurrency:
group: ${{ github.ref }}-${{ github.workflow }} group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true cancel-in-progress: true
env: env:
CHANNEL: ${{ github.ref_type == 'tag' && endsWith(github.ref_name, 'dev') && 'dev' || github.ref_type != 'tag' && 'dev' || 'prod' }} CHANNEL: "${{ inputs.channel }}"
NDK_VERSION: r26b NDK_VERSION: r26b
UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
TAG_NAME: "${{ inputs.tag-name }}"
jobs: jobs:
build: build:
@@ -55,17 +55,11 @@ jobs:
targets: dmg targets: dmg
filename: hiddify-macos-universal filename: hiddify-macos-universal
# - platform: ios
# os: macos-13
# aarch: universal
# filename: hiddify-ios
# targets: ipa
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install macos dmg needed tools - name: Setup Apple dependencies
if: matrix.platform == 'macos' || matrix.platform == 'ios' if: matrix.platform == 'macos' || matrix.platform == 'ios'
run: | run: |
# xcode-select --install || softwareupdate --all --install --force # xcode-select --install || softwareupdate --all --install --force
@@ -75,6 +69,7 @@ jobs:
python3 -m pip install --upgrade setuptools pip python3 -m pip install --upgrade setuptools pip
brew install create-dmg tree brew install create-dmg tree
npm install -g appdmg npm install -g appdmg
- name: Setup Flutter - name: Setup Flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2
with: with:
@@ -125,7 +120,7 @@ jobs:
make translate make translate
make gen make gen
- name: Get Libs ${{ matrix.platform }} - name: Get Libs & Bindings ${{ matrix.platform }}
run: | run: |
make ${{ matrix.platform }}-libs make ${{ matrix.platform }}-libs
@@ -172,14 +167,14 @@ jobs:
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PACKET_TUNNEL_PATH ~/Library/MobileDevice/Provisioning\ Profiles cp $PP_PACKET_TUNNEL_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Release ${{ matrix.platform }} - name: Build ${{ matrix.platform }}
env: env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: | run: |
make ${{ matrix.platform }}-release make ${{ matrix.platform }}-release
- name: Upload Debug Symbols - name: Upload Debug Symbols
if: ${{ github.ref_type == 'tag' }} if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
env: env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
@@ -194,7 +189,7 @@ jobs:
tree tree
.\scripts\package_windows.ps1 .\scripts\package_windows.ps1
- name: Copy to out Android apk - name: Copy to out Android APK
if: matrix.platform == 'android-apk' if: matrix.platform == 'android-apk'
run: | run: |
mkdir out mkdir out
@@ -204,7 +199,7 @@ jobs:
cp ./build/app/outputs/flutter-apk/*x86_64*.apk out/hiddify-android-x86_64.apk || echo "no x64 apk" cp ./build/app/outputs/flutter-apk/*x86_64*.apk out/hiddify-android-x86_64.apk || echo "no x64 apk"
cp ./build/app/outputs/flutter-apk/app-release.apk out/hiddify-android-universal.apk || echo "no universal apk" cp ./build/app/outputs/flutter-apk/app-release.apk out/hiddify-android-universal.apk || echo "no universal apk"
- name: Copy to out Android aab - name: Copy to out Android AAB
if: matrix.platform == 'android-aab' if: matrix.platform == 'android-aab'
run: | run: |
mkdir out mkdir out
@@ -233,43 +228,23 @@ jobs:
mv *.zip ../out/ mv *.zip ../out/
fi fi
# - name: Copy to out unix
# if: matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'ios'
# run: |
# ls -R dist/
# mkdir out
# mkdir tmp_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 {} "tmp_out" \;
# done
# mv tmp_out/*.AppImage tmp_out/hiddify-linux-x64.AppImage &&\
# chmod +x tmp_out/hiddify-linux-x64.AppImage &&\
# cp ./.github/help/linux/* tmp_out/ \
# ||echo "no app image"
# mv tmp_out/*.dmg tmp_out/hiddify-macos-universal.dmg && \
# cp ./.github/help/mac-windows/* tmp_out/ \
# || echo "no macos dmg"
# cd tmp_out && 7z a hiddify-${{matrix.platform}}-x64.zip ./ && mv *.zip ../out/
# Important! Cleanup: remove the certificate and provisioning profile from the runner!
- name: Clean up keychain and provisioning profile - name: Clean up keychain and provisioning profile
if: ${{ always() && startsWith(matrix.os,'macos')}} if: ${{ always() && startsWith(matrix.os,'macos')}}
run: | run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
- name: Upload Artifact - name: Upload Artifact
if: env.UPLOAD_ARTIFACT == 'true'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: artifact name: artifact
path: ./out path: ./out
retention-days: 2 retention-days: 2
upload-draft: update-draft:
permissions: write-all permissions: write-all
if: ${{ github.ref_type == 'branch' }} if: ${{ inputs.upload-artifact }}
needs: [build] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -292,7 +267,6 @@ jobs:
- name: Create or Update Draft Release - name: Create or Update Draft Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: ${{ github.ref_type != 'tag' }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
@@ -303,7 +277,7 @@ jobs:
upload-release: upload-release:
permissions: write-all permissions: write-all
if: ${{ github.ref_type == 'tag' }} if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
needs: [build] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -328,7 +302,7 @@ jobs:
# prelease=$(curl --silent "https://api.github.com/repos/hiddify/hiddify-next/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")') # prelease=$(curl --silent "https://api.github.com/repos/hiddify/hiddify-next/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
# current="${{ github.ref_name }}" # current="${{ github.ref_name }}"
# gitchangelog $prelease..$current > release.md # gitchangelog $prelease..$current > release.md
sed 's|RELEASE_TAG|${{ github.ref_name }}|g' ./.github/release_message.md >> release.md sed 's|RELEASE_TAG|${{ env.TAG_NAME }}|g' ./.github/release_message.md >> release.md
- name: Upload Release - name: Upload Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@@ -337,7 +311,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
prerelease: ${{ env.CHANNEL == 'dev' }} prerelease: ${{ env.CHANNEL == 'dev' }}
tag_name: ${{ github.ref_name }} tag_name: ${{ env.TAG_NAME }}
body_path: './release.md' body_path: './release.md'
files: ./out/* files: ./out/*
@@ -349,50 +323,6 @@ jobs:
with: with:
serviceAccountJson: service_account.json serviceAccountJson: service_account.json
packageName: app.hiddify.com packageName: app.hiddify.com
releaseName: ${{ github.ref }} releaseName: ${{ env.TAG_NAME }}
releaseFiles: ./hiddify-android-market.aab releaseFiles: ./hiddify-android-market.aab
# track: ${{ env.CHANNEL == 'dev' && 'beta' || 'internal' }} track: 'beta'
track: 'beta'
# - name: "Upload app to TestFlight"
# uses: apple-actions/upload-testflight-build@v1
# with:
# app-path: "./hiddify-ios-universal.ipa"
# issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
# api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
# api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}
upload-winget-release:
permissions: write-all
if: ${{ github.ref_type == 'tag' }}
needs: [upload-release]
runs-on: windows-latest
steps:
- name: Find & Replace
id: version
uses: ashley-taylor/regex-property-action@v1.3
with:
value: '${{ github.ref_name }}'
regex: '^v|.dev$'
flags: 'gi' # Optional, defaults to "g"
replacement: ''
- name: Winget Publish
if: ${{ env.CHANNEL != 'dev' }}
uses: isaacrlevin/winget-publish-action@v.5
with:
publish-type: 'Update'
user: 'Hiddify'
package: 'Next'
version: ${{ steps.version.outputs.value }}
url: 'https://github.com/hiddify/hiddify-next/releases/download/${{ github.ref_name }}/hiddify-windows-x64-setup.zip'
token: ${{ secrets.WINGET_TOKEN }}
- name: Winget Publish Beta
uses: isaacrlevin/winget-publish-action@v.5
with:
publish-type: 'Update'
user: 'Hiddify'
package: 'Next.Beta'
version: ${{ steps.version.outputs.value }}
url: 'https://github.com/hiddify/hiddify-next/releases/download/${{ github.ref_name }}/hiddify-windows-x64-setup.zip'
token: ${{ secrets.WINGET_TOKEN }}

23
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: CI
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- '.vscode/'
- 'appcast.xml'
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
- '.vscode/'
- 'appcast.xml'
jobs:
run:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
upload-artifact: false

15
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+[-.](dev|beta)'
jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
upload-artifact: true
tag-name: "${{ github.ref_name }}"
channel: "${{ github.ref_type == 'tag' && endsWith(github.ref_name, 'dev') && 'dev' || github.ref_type != 'tag' && 'dev' || 'prod' }}"

17
.github/workflows/winget.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Publish to WinGet
on:
release:
types: [released]
env:
IDENTIFIER: ${{ endsWith(github.event.release.tag_name, 'dev') && 'Hiddify.Next.Beta' || 'Hiddify.Next' }}
jobs:
publish:
runs-on: windows-latest
steps:
- uses: vedantmgoyal2009/winget-releaser@v1
with:
identifier: ${{ env.IDENTIFIER }}
version: ${{ github.event.release.tag_name }}
token: ${{ secrets.WINGET_TOKEN }}