From f9d444a8a965451834fa76b4d0883949258ae602 Mon Sep 17 00:00:00 2001 From: tobyxdd Date: Thu, 12 Feb 2026 18:18:39 -0800 Subject: [PATCH] feat: improve workflows --- .github/workflows/build-common.yml | 78 ++++++++++++++++++++++++++++++ .github/workflows/experimental.yml | 10 ++++ .github/workflows/master.yml | 73 +--------------------------- .github/workflows/release.yml | 37 ++++---------- 4 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/build-common.yml create mode 100644 .github/workflows/experimental.yml diff --git a/.github/workflows/build-common.yml b/.github/workflows/build-common.yml new file mode 100644 index 0000000..3710be5 --- /dev/null +++ b/.github/workflows/build-common.yml @@ -0,0 +1,78 @@ +name: "Build common" + +on: + workflow_call: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + outputs: + files: ${{ steps.list-files.outputs.files }} + + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.25" + + - name: Setup Python # This is for the build script + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r29 + add-to-path: false + + - name: Run build script + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",") + python hyperbole.py build -r + + - name: Generate hashes + run: | + for file in build/*; do + sha256sum $file >> build/hashes.txt + done + + - name: List build files + id: list-files + run: | + files=$(ls -1 build/ | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "files=$files" >> $GITHUB_OUTPUT + + - name: Upload build directory + uses: actions/upload-artifact@v4 + with: + name: build-temp-${{ github.sha }} + path: build/ + + upload: + name: Upload ${{ matrix.file }} + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + file: ${{ fromJson(needs.build.outputs.files) }} + steps: + - name: Download build + uses: actions/download-artifact@v4 + with: + name: build-temp-${{ github.sha }} + + - name: Upload ${{ matrix.file }} + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.file }} + path: ${{ matrix.file }} diff --git a/.github/workflows/experimental.yml b/.github/workflows/experimental.yml new file mode 100644 index 0000000..34f5b3b --- /dev/null +++ b/.github/workflows/experimental.yml @@ -0,0 +1,10 @@ +name: "Build experimental branches" + +on: + push: + branches: + - exp/** + +jobs: + build: + uses: ./.github/workflows/build-common.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index fbc7eed..13426b4 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -7,75 +7,4 @@ on: jobs: build: - name: Build - runs-on: ubuntu-latest - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - outputs: - files: ${{ steps.list-files.outputs.files }} - - steps: - - name: Check out - uses: actions/checkout@v4 - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.25" - - - name: Setup Python # This is for the build script - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r29 - add-to-path: false - - - name: Run build script - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - run: | - export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",") - python hyperbole.py build -r - - - name: Generate hashes - run: | - for file in build/*; do - sha256sum $file >> build/hashes.txt - done - - - name: List build files - id: list-files - run: | - files=$(ls -1 build/ | jq -R -s -c 'split("\n") | map(select(length > 0))') - echo "files=$files" >> $GITHUB_OUTPUT - - - name: Upload build directory - uses: actions/upload-artifact@v4 - with: - name: build-temp-${{ github.sha }} - path: build/ - retention-days: 1 - - upload: - name: Upload ${{ matrix.file }} - needs: build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - file: ${{ fromJson(needs.build.outputs.files) }} - steps: - - name: Download build - uses: actions/download-artifact@v4 - with: - name: build-temp-${{ github.sha }} - - - name: Upload ${{ matrix.file }} - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.file }} - path: ${{ matrix.file }} + uses: ./.github/workflows/build-common.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 847f4f6..36dd7d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,11 +7,12 @@ on: jobs: build: - name: Build - runs-on: ubuntu-latest - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true + uses: ./.github/workflows/build-common.yml + publish: + name: Publish + needs: build + runs-on: ubuntu-latest steps: - name: Check out uses: actions/checkout@v4 @@ -20,34 +21,16 @@ jobs: id: get_version run: echo "version=$(git describe --tags --always --match 'app/v*' | sed -n 's|app/\([^/-]*\)\(-.*\)\{0,1\}|\1|p')" >> $GITHUB_OUTPUT - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: "1.25" - - - name: Setup Python # This is for the build script + - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.11" - - uses: nttld/setup-ndk@v1 - id: setup-ndk + - name: Download build + uses: actions/download-artifact@v4 with: - ndk-version: r29 - add-to-path: false - - - name: Run build script - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - run: | - export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",") - python hyperbole.py build -r - - - name: Generate hashes - run: | - for file in build/*; do - sha256sum $file >> build/hashes.txt - done + name: build-temp-${{ github.sha }} + path: build - name: Upload GitHub uses: softprops/action-gh-release@v2