From 90c270fff42948092c53b2e1012fbecb5d6753aa Mon Sep 17 00:00:00 2001 From: hev Date: Sun, 12 May 2024 21:37:36 +0800 Subject: [PATCH] CI: Merge release into build. --- .github/workflows/build.yaml | 40 ++++++++++++++++ .github/workflows/release.yaml | 85 ---------------------------------- 2 files changed, 40 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7ff2b9b..ab9bcdf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,9 +2,38 @@ name: "Build" on: push: + branches: + - '**' pull_request: + release: + types: + - published jobs: + source: + name: Source + runs-on: ubuntu-20.04 + if: github.event_name == 'release' + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + submodules: true + - name: Gen Source + run: | + mkdir -p hev-socks5-tunnel-${{ github.ref_name }} + git ls-files --recurse-submodules | tar c -O -T- | tar x -C hev-socks5-tunnel-${{ github.ref_name }} + tar caf hev-socks5-tunnel-${{ github.ref_name }}.tar.gz hev-socks5-tunnel-${{ github.ref_name }} + - name: Upload source + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: hev-socks5-tunnel-${{ github.ref_name }}.tar.gz + asset_name: hev-socks5-tunnel-${{ github.ref_name }}.tar.gz + asset_content_type: application/octet-stream linux: name: Linux runs-on: ubuntu-20.04 @@ -49,9 +78,20 @@ jobs: wget https://github.com/musl-cross/musl-cross/releases/download/20240317/${{ matrix.tool }}.tgz sudo tar xf ${{ matrix.tool }}.tgz -C /opt/x-tools make CROSS_PREFIX=/opt/x-tools/${{ matrix.tool }}/bin/${{ matrix.tool }}- CFLAGS=${{ matrix.env.CFLAGS }} ENABLE_STATIC=1 -j`nproc` + - name: Upload ${{ matrix.name }} + if: github.event_name == 'release' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: bin/hev-socks5-tunnel + asset_name: hev-socks5-tunnel-linux-${{ matrix.name }} + asset_content_type: application/octet-stream macos: name: macOS runs-on: macos-14 + if: github.event_name != 'release' steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 58d1d6b..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release - -on: - release: - types: - - published - -jobs: - source: - name: Source - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 1 - submodules: true - - name: Gen Source - run: | - mkdir -p hev-socks5-tunnel-${{ github.ref_name }} - git ls-files --recurse-submodules | tar c -O -T- | tar x -C hev-socks5-tunnel-${{ github.ref_name }} - tar caf hev-socks5-tunnel-${{ github.ref_name }}.tar.gz hev-socks5-tunnel-${{ github.ref_name }} - - name: Upload source - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: hev-socks5-tunnel-${{ github.ref_name }}.tar.gz - asset_name: hev-socks5-tunnel-${{ github.ref_name }}.tar.gz - asset_content_type: application/octet-stream - - build: - name: Build - runs-on: ubuntu-20.04 - strategy: - matrix: - include: - - name: arm64 - tool: aarch64-unknown-linux-musl - - name: arm32 - tool: arm-unknown-linux-musleabi - - name: arm32hf - tool: arm-unknown-linux-musleabihf - - name: loong64 - tool: loongarch64-unknown-linux-musl - - name: mips64el - tool: mips64el-unknown-linux-musl - - name: mips64 - tool: mips64-unknown-linux-musl - - name: mips32el - tool: mipsel-unknown-linux-musl - - name: mips32 - tool: mips-unknown-linux-musl - - name: riscv32 - tool: riscv32-unknown-linux-musl - - name: riscv64 - tool: riscv64-unknown-linux-musl - - name: x86_32 - tool: x86_64-multilib-linux-musl - env: - CFLAGS: "-m32" - - name: x86_64 - tool: x86_64-multilib-linux-musl - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 1 - submodules: true - - name: Build ${{ matrix.name }} - run: | - sudo mkdir -p /opt/x-tools - wget https://github.com/musl-cross/musl-cross/releases/download/20240317/${{ matrix.tool }}.tgz - sudo tar xf ${{ matrix.tool }}.tgz -C /opt/x-tools - make CROSS_PREFIX=/opt/x-tools/${{ matrix.tool }}/bin/${{ matrix.tool }}- CFLAGS=${{ matrix.env.CFLAGS }} ENABLE_STATIC=1 -j`nproc` - - name: Upload ${{ matrix.name }} - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: bin/hev-socks5-tunnel - asset_name: hev-socks5-tunnel-linux-${{ matrix.name }} - asset_content_type: application/octet-stream