name: Release on: workflow_dispatch: push: tags: - "v*" permissions: contents: write jobs: build: name: Build (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest binary: pomoru archive: pomoru-linux-x86_64.tar.gz - os: windows-latest binary: pomoru.exe archive: pomoru-windows-x86_64.zip - os: macos-latest binary: pomoru archive: pomoru-macos-arm64.zip steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Rust uses: dtolnay/rust-toolchain@stable - name: Build run: cargo build --release - name: Package (Linux) if: runner.os == 'Linux' shell: bash run: | mkdir package cp target/release/${{ matrix.binary }} package/ cp README.md package/ cp LICENSE package/ tar -czf ${{ matrix.archive }} -C package . - name: Package (macOS) if: runner.os == 'macOS' shell: bash run: | mkdir package cp target/release/${{ matrix.binary }} package/ cp README.md package/ cp LICENSE package/ cd package zip -r ../${{ matrix.archive }} . cd .. - name: Package (Windows) if: runner.os == 'Windows' shell: pwsh run: | New-Item -ItemType Directory -Path package -Force Copy-Item target/release/${{ matrix.binary }} package/ Copy-Item README.md package/ Copy-Item LICENSE package/ Compress-Archive ` -Path package/* ` -DestinationPath ${{ matrix.archive }} - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.archive }} path: ${{ matrix.archive }} release: name: Create Release needs: build if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Download Artifacts uses: actions/download-artifact@v4 with: path: release-assets - name: Flatten Artifacts run: | mkdir final find release-assets -type f \ \( -name "*.tar.gz" -o -name "*.zip" \) \ -exec cp {} final/ \; - name: Generate SHA256 Checksums run: | cd final sha256sum * > sha256sums.txt - name: Create Draft Release uses: softprops/action-gh-release@v2 with: draft: true generate_release_notes: true files: | final/*