diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abf05cc..2e8349b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,14 @@ -name: Cross Build +name: Cross Build and Release on: - # workflow_dispatch: # Enables manual triggering + workflow_dispatch: # Enables manual triggering push: tags: - - "v*" # Matches tags like v1.0.0, v2.3.4, etc. + - "v[0-9]+.[0-9]+.[0-9]+" # Matches tags like v1.0.0, v2.3.4, etc. jobs: build-windows: - runs-on: ubuntu-latest # Ubuntu runner for Linux and Windows builds + runs-on: ubuntu-latest steps: # Checkout the code @@ -39,7 +39,7 @@ jobs: path: target/x86_64-pc-windows-gnu/release/jobshell.exe build-macos: - runs-on: macos-latest # macOS runner for macOS builds + runs-on: macos-latest steps: # Checkout the code @@ -82,3 +82,70 @@ jobs: name: jobshell-macos-aarch64-binary path: target/aarch64-apple-darwin/release/jobshell + release: + runs-on: ubuntu-latest + needs: + - build-windows + - build-macos + + steps: + # Checkout the code + - name: Checkout repository + uses: actions/checkout@v3 + + # Download Windows artifact + - name: Download Windows artifact + uses: actions/download-artifact@v3 + with: + name: windows-binary + + # Download macOS artifacts + - name: Download macOS (x86_64) artifact + uses: actions/download-artifact@v3 + with: + name: jobshell-macos-x86_64-binary + + - name: Download macOS (aarch64) artifact + uses: actions/download-artifact@v3 + with: + name: jobshell-macos-aarch64-binary + + # Create GitHub Release + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref_name }} # Use the latest pushed tag + release_name: "Release ${{ github.ref_name }}" + body: | + ### Changes in this Release + - Windows and macOS binaries included. + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Upload Release Assets + - name: Upload Windows binary + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: target/x86_64-pc-windows-gnu/release/jobshell.exe + asset_name: jobshell-windows-x86_64.exe + asset_content_type: application/octet-stream + + - name: Upload macOS (x86_64) binary + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: target/x86_64-apple-darwin/release/jobshell + asset_name: jobshell-macos-x86_64 + asset_content_type: application/octet-stream + + - name: Upload macOS (aarch64) binary + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: target/aarch64-apple-darwin/release/jobshell + asset_name: jobshell-macos-aarch64 + asset_content_type: application/octet-stream