diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0f7910d..bf75508 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,6 +3,8 @@ name: Rust on: push: branches: [ "main" ] + tags: + - v[0-9]+.* pull_request: branches: [ "main" ] @@ -39,3 +41,39 @@ jobs: run: cargo clippy -- -D warnings - name: Check formatting run: cargo fmt -- --check + + create-release: + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: taiki-e/create-gh-release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + upload-assets: + if: startsWith(github.ref, 'refs/tags/') + needs: create-release + permissions: + contents: write + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-apple-darwin + os: macos-latest + - target: x86_64-pc-windows-msvc + os: windows-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: taiki-e/upload-rust-binary-action@v1.27.0 + with: + bin: noentropy + target: ${{ matrix.target }} + tar: unix + zip: windows + token: ${{ secrets.GITHUB_TOKEN }}