From e34c259fe1007e39f2d80fe3ee1e78bb1e416a15 Mon Sep 17 00:00:00 2001 From: hev Date: Mon, 4 Nov 2024 23:12:41 +0800 Subject: [PATCH] CI: Allow build to be triggered manually. --- .github/workflows/build.yaml | 61 +++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f7e313a..1d54c81 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,15 +8,15 @@ on: release: types: - published + workflow_dispatch: jobs: source: name: Source runs-on: ubuntu-22.04 - if: github.event_name == 'release' steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 submodules: true @@ -29,16 +29,15 @@ jobs: mkdir -p natmap-${{ github.ref_name }} git ls-files --recurse-submodules | tar c -O -T- | tar x -C natmap-${{ github.ref_name }} echo ${REV_ID} > natmap-${{ github.ref_name }}/.version - tar caf natmap-${{ github.ref_name }}.tar.gz natmap-${{ github.ref_name }} + tar cJf natmap-${{ github.ref_name }}.tar.xz natmap-${{ github.ref_name }} - name: Upload source - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/upload-artifact@v4 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: natmap-${{ github.ref_name }}.tar.gz - asset_name: natmap-${{ github.ref_name }}.tar.gz - asset_content_type: application/octet-stream + name: natmap-${{ github.ref_name }}.tar.xz + path: natmap-${{ github.ref_name }}.tar.xz + if-no-files-found: error + retention-days: 1 + linux: name: Linux runs-on: ubuntu-22.04 @@ -110,15 +109,39 @@ jobs: sudo tar xf ${{ matrix.tool }}.tar.xz -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 }} + uses: actions/upload-artifact@v4 + with: + name: natmap-linux-${{ matrix.name }} + path: bin/natmap + if-no-files-found: error + retention-days: 1 + + release: + name: Release + runs-on: ubuntu-22.04 + needs: + - source + - linux + if: github.event_name == 'release' + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Download artifacts + uses: actions/download-artifact@v4 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: bin/natmap - asset_name: natmap-linux-${{ matrix.name }} - asset_content_type: application/octet-stream + path: release + pattern: "natmap-*" + merge-multiple: true + - name: Upload artifacts + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for i in release/natmap-*; do + gh release upload ${{ github.event.release.tag_name }} $i + done + macos: name: macOS runs-on: macos-14 @@ -132,6 +155,7 @@ jobs: - name: Build run: | make + android: name: Android runs-on: ubuntu-22.04 @@ -150,6 +174,7 @@ jobs: - name: Build run: | ./android-ndk-r27b/ndk-build + llvm: name: LLVM runs-on: ubuntu-22.04