From 8862dec8064fb124d1ff1b0c3614a55ad9a05aff Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Sun, 24 Nov 2024 21:34:50 +0100 Subject: [PATCH] chore: Introduce release-plz --- .github/workflows/cargopublish.yml | 29 ---------------- .github/workflows/release.yml | 53 ++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/cargopublish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/cargopublish.yml b/.github/workflows/cargopublish.yml deleted file mode 100644 index a003db5c..00000000 --- a/.github/workflows/cargopublish.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This workflows will upload a Crates using cargo when a release is created -name: Upload Cargo Crates - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install latest rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - override: true - - name: Publish odbc-api to cargo - env: - CARGO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} - run: | - cargo publish --token "${CARGO_TOKEN}" --package odbc-api-derive - cargo publish --token "${CARGO_TOKEN}" --package odbc-api \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..dd8b132c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + + # Release unpublished packages. + release-plz-release: + name: Release-plz release + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + with: + command: release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} + + # Create a PR with the new versions and changelog, preparing the next release. + release-plz-pr: + name: Release-plz PR + runs-on: ubuntu-latest + concurrency: + group: release-plz-${{ github.ref }} + cancel-in-progress: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} \ No newline at end of file