From 76961deeef1c091a7ced604f1fd34518098432de Mon Sep 17 00:00:00 2001 From: Ririsoft Date: Sun, 16 Jun 2024 15:55:41 +0200 Subject: [PATCH] ci/cd: release on push * Create a github release on release tag push * Publish to crates.io --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/release.yml 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