From 4a471150f520e1b4a2b8e6d5bead9eb164781be2 Mon Sep 17 00:00:00 2001 From: danemadsen Date: Sat, 27 Jul 2024 20:31:58 +1000 Subject: [PATCH] workflows --- .github/workflows/build-linux.yml | 2 +- .github/workflows/build-macos.yml | 16 ++--- .github/workflows/release.yml | 97 +++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 3fa2a74..ced99c2 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -32,5 +32,5 @@ jobs: - name: Upload Build Artifacts uses: actions/upload-artifact@v3 with: - name: build-linux + name: linux-x86_64 path: lib/ \ No newline at end of file diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index fbcf4b0..4fbbe1d 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -49,7 +49,7 @@ jobs: - name: Upload Build Artifacts uses: actions/upload-artifact@v3 with: - name: build-macos-${{ matrix.arch }} + name: macos-${{ matrix.arch }} path: lib/ create-universal-dylibs: @@ -59,25 +59,25 @@ jobs: - name: Download x86_64 Build Artifacts uses: actions/download-artifact@v3 with: - name: build-macos-x86_64 - path: build-macos-x86_64 + name: macos-x86_64 + path: macos-x86_64 - name: Download arm64 Build Artifacts uses: actions/download-artifact@v3 with: - name: build-macos-arm64 - path: build-macos-arm64 + name: macos-arm64 + path: macos-arm64 - name: Create Universal dylibs run: | mkdir -p universal/lib - for dylib in build-macos-x86_64/*.dylib; do + for dylib in macos-x86_64/*.dylib; do dylib_name=$(basename $dylib) - lipo -create build-macos-x86_64/$dylib_name build-macos-arm64/$dylib_name -output universal/$dylib_name + lipo -create macos-x86_64/$dylib_name macos-arm64/$dylib_name -output universal/$dylib_name done - name: Upload Universal dylibs uses: actions/upload-artifact@v3 with: - name: universal-dylibs + name: macos-universal path: universal/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..82d034f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,97 @@ +name: Create Release + +on: + workflow_run: + workflows: + - "Build Linux" + - "Build MacOS" + types: + - completed + +jobs: + create-release: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Get Current Git Commit + id: git_commit + run: echo "::set-output name=hash::$(git rev-parse HEAD)" + + - name: Download Linux Build Artifacts + uses: actions/download-artifact@v3 + with: + name: linux-x86_64 + path: artifacts/linux-x86_64 + + - name: Download MacOS x86_64 Build Artifacts + uses: actions/download-artifact@v3 + with: + name: macos-x86_64 + path: artifacts/macos-x86_64 + + - name: Download MacOS arm64 Build Artifacts + uses: actions/download-artifact@v3 + with: + name: macos-arm64 + path: artifacts/macos-arm64 + + - name: Download MacOS Universal Build Artifacts + uses: actions/download-artifact@v3 + with: + name: macos-universal + path: artifacts/macos-universal + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.git_commit.outputs.hash }} + release_name: Release ${{ steps.git_commit.outputs.hash }} + draft: false + prerelease: false + + - name: Upload Linux Build Artifact to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/linux-x86_64/lib + asset_name: linux-x86_64-lib.zip + asset_content_type: application/zip + + - name: Upload MacOS x86_64 Build Artifact to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/macos-x86_64/lib + asset_name: macos-x86_64-lib.zip + asset_content_type: application/zip + + - name: Upload MacOS arm64 Build Artifact to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/macos-arm64/lib + asset_name: macos-arm64-lib.zip + asset_content_type: application/zip + + - name: Upload MacOS Universal Build Artifact to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: artifacts/macos-universal/lib + asset_name: macos-universal-lib.zip + asset_content_type: application/zip