diff options
| author | A Farzat <a@farzat.xyz> | 2026-03-09 09:56:55 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2026-03-09 09:56:55 +0300 |
| commit | e1d672318640cded0febdc3a6f11d35e319ecb3f (patch) | |
| tree | 815162262a2f22a78c01d4d70be6e11428c8de84 | |
| parent | f914dd7533edccc4a01afb5a69e5a924e2c80fc9 (diff) | |
| download | oreilly-epub-e1d672318640cded0febdc3a6f11d35e319ecb3f.tar.gz oreilly-epub-e1d672318640cded0febdc3a6f11d35e319ecb3f.zip | |
Create releases using GitHub workflowsv0.1.1
| -rw-r--r-- | .github/workflows/ci.yml | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9062d46..18d580e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,11 +57,44 @@ jobs: - name: Run tests run: cargo test --all - release: + create_release: needs: test if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create.outputs.upload_url }} + + steps: + - name: Create GitHub Release + id: create + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref_name }} # 'v0.1.1' + release_name: ${{ github.ref_name }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build_and_upload: + needs: [test, create_release] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + - os: ubuntu-latest + asset_name: oreilly-epub-linux-x86_64 + bin_path: target/release/oreilly-epub + - os: macos-latest + asset_name: oreilly-epub-macos-x86_64 + bin_path: target/release/oreilly-epub + - os: windows-latest + asset_name: oreilly-epub-windows-x86_64.exe + bin_path: target/release/oreilly-epub.exe + steps: - name: Checkout uses: actions/checkout@v4 @@ -81,8 +114,24 @@ jobs: - name: Build release binary run: cargo build --release - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Package binary (Unix) + if: runner.os != 'Windows' + run: | + cp "${{ matrix.bin_path }}" "./${{ matrix.asset_name }}" + shell: bash + + - name: Package binary (Windows) + if: runner.os == 'Windows' + run: | + Copy-Item "${{ matrix.bin_path }}" ".\${{ matrix.asset_name }}" + shell: pwsh + + - name: Upload to GitHub Release + uses: actions/upload-release-asset@v1 with: - name: oreilly-epub-linux-x86_64 - path: target/release/oreilly-epub + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./${{ matrix.asset_name }} + asset_name: ${{ matrix.asset_name }} + asset_content_type: application/octet-stream + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
