Skip to content

Commit

Permalink
Change workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
0xConsumer committed Jan 13, 2024
1 parent 251fa42 commit d5d26dd
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 101 deletions.
132 changes: 31 additions & 101 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: Build
on:
push:
branches:
- main
tags:
- 'v*'
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
- '!.github/workflows/build.yml'
- 'appcast.xml'
# pull_request:
# branches:
# - main
workflow_call:
inputs:
upload-artifact:
type: boolean
default: true
tag-name:
type: string
default: "draft"
channel:
type: string
default: "dev"

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' }}
CHANNEL: "${{ inputs.channel }}"
NDK_VERSION: r26b
UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
TAG_NAME: "${{ inputs.tag-name }}"

jobs:
build:
Expand Down Expand Up @@ -55,17 +55,11 @@ jobs:
targets: dmg
filename: hiddify-macos-universal

# - platform: ios
# os: macos-13
# aarch: universal
# filename: hiddify-ios
# targets: ipa

runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Install macos dmg needed tools
- name: Setup Apple dependencies
if: matrix.platform == 'macos' || matrix.platform == 'ios'
run: |
# xcode-select --install || softwareupdate --all --install --force
Expand All @@ -75,6 +69,7 @@ jobs:
python3 -m pip install --upgrade setuptools pip
brew install create-dmg tree
npm install -g appdmg
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
Expand Down Expand Up @@ -125,7 +120,7 @@ jobs:
make translate
make gen
- name: Get Libs ${{ matrix.platform }}
- name: Get Libs & Bindings ${{ matrix.platform }}
run: |
make ${{ matrix.platform }}-libs
Expand Down Expand Up @@ -172,14 +167,14 @@ jobs:
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PACKET_TUNNEL_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Release ${{ matrix.platform }}
- name: Build ${{ matrix.platform }}
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: |
make ${{ matrix.platform }}-release
- name: Upload Debug Symbols
if: ${{ github.ref_type == 'tag' }}
if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
Expand All @@ -194,7 +189,7 @@ jobs:
tree
.\scripts\package_windows.ps1
- name: Copy to out Android apk
- name: Copy to out Android APK
if: matrix.platform == 'android-apk'
run: |
mkdir out
Expand All @@ -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/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'
run: |
mkdir out
Expand Down Expand Up @@ -233,43 +228,23 @@ jobs:
mv *.zip ../out/
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
if: ${{ always() && startsWith(matrix.os,'macos')}}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
- name: Upload Artifact
if: env.UPLOAD_ARTIFACT == 'true'
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./out
retention-days: 2

upload-draft:
update-draft:
permissions: write-all
if: ${{ github.ref_type == 'branch' }}
if: ${{ inputs.upload-artifact }}
needs: [build]
runs-on: ubuntu-latest
steps:
Expand All @@ -292,7 +267,6 @@ jobs:

- name: Create or Update Draft Release
uses: softprops/action-gh-release@v1
if: ${{ github.ref_type != 'tag' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -303,7 +277,7 @@ jobs:

upload-release:
permissions: write-all
if: ${{ github.ref_type == 'tag' }}
if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
needs: [build]
runs-on: ubuntu-latest
steps:
Expand All @@ -328,7 +302,7 @@ jobs:
# prelease=$(curl --silent "https://api.github.com/repos/hiddify/hiddify-next/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
# current="${{ github.ref_name }}"
# 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
uses: softprops/action-gh-release@v1
Expand All @@ -337,7 +311,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ env.CHANNEL == 'dev' }}
tag_name: ${{ github.ref_name }}
tag_name: ${{ env.TAG_NAME }}
body_path: './release.md'
files: ./out/*

Expand All @@ -349,50 +323,6 @@ jobs:
with:
serviceAccountJson: service_account.json
packageName: app.hiddify.com
releaseName: ${{ github.ref }}
releaseName: ${{ env.TAG_NAME }}
releaseFiles: ./hiddify-android-market.aab
# track: ${{ env.CHANNEL == 'dev' && 'beta' || 'internal' }}
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/[email protected]
with:
value: '${{ github.ref_name }}'
regex: '^v|.dev$'
flags: 'gi' # Optional, defaults to "g"
replacement: ''
- name: Winget Publish
if: ${{ env.CHANNEL != 'dev' }}
uses: isaacrlevin/[email protected]
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/[email protected]
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 }}
track: 'beta'
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions .github/workflows/winget.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit d5d26dd

Please sign in to comment.