diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7a31844 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release +on: + push: + tags: [ "v[0-9]+.*" ] + +permissions: + contents: write + +jobs: + create-release: + if: github.repository_owner == 'ririsoft' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: taiki-e/create-gh-release-action@v1 + with: + changelog: CHANGELOG.md + title: $version + token: ${{ secrets.GITHUB_TOKEN }} + + publish-release: + if: github.repository_owner == 'ririsoft' + needs: + - create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + + - name: Verify package can be published + run: cargo publish --dry-run + + - name: Publish package to crates.io + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: cargo publish diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2edacac..49af70f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,6 +3,8 @@ on: push: branches: - master + tags-ignore: + - "v[0-9]+.*" pull_request: branches: - master