From e731a0535f45c19d5d1e9744cfcb1fcb2506e2d8 Mon Sep 17 00:00:00 2001 From: Tim Van Wassenhove Date: Tue, 23 Apr 2024 11:35:19 +0200 Subject: [PATCH] ci: switch to release-plz --- .github/workflows/draft_release.yml | 58 ------------------------- .github/workflows/publish_artifacts.yml | 41 ----------------- .github/workflows/published_release.yml | 35 --------------- .github/workflows/release-plz.yml | 28 ++++++++++++ 4 files changed, 28 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/draft_release.yml delete mode 100644 .github/workflows/publish_artifacts.yml delete mode 100644 .github/workflows/published_release.yml create mode 100644 .github/workflows/release-plz.yml diff --git a/.github/workflows/draft_release.yml b/.github/workflows/draft_release.yml deleted file mode 100644 index c4edfc4..0000000 --- a/.github/workflows/draft_release.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Draft release - -on: - workflow_dispatch: - inputs: - version: - description: 'Version to release (eg: 0.1.0)' - required: true - -jobs: - - create_draft_release: - runs-on: ubuntu-latest - outputs: - commitish: ${{ steps.commit.outputs.commitish }} - steps: - - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: true - - - name: Bump crate version - uses: thomaseizinger/set-crate-version@master - with: - version: ${{ github.event.inputs.version }} - - - name: Create release branch - run: git checkout -b release/${{ github.event.inputs.version }} - - - name: Initialize mandatory git config - run: | - git config user.name "GitHub actions" - git config user.email noreply@github.com - - - name: Commit manifest file - id: commit - run: | - git add Cargo.toml - git commit --message "Prepare release ${{ github.event.inputs.version }}" - echo "::set-output name=commitish::$(git rev-parse HEAD)" - shell: bash - - - name: Push new branch - run: git push origin release/${{ github.event.inputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v1 - with: - draft: true - name: Release v${{ github.event.inputs.version }} - tag_name: v${{ github.event.inputs.version }} - target_commitish: ${{ steps.commit.outputs.commitish }} - - diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml deleted file mode 100644 index baeed0c..0000000 --- a/.github/workflows/publish_artifacts.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Publish artifacts - -on: - workflow_call: - inputs: - tag_name: - type: string - required: true - secrets: - CARGO_REGISTRY_TOKEN: - required: true - -jobs: - - publish_crate: - name: Publish crate ${{ inputs.tag_name }} - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: ${{ inputs.tag_name }} - submodules: true - - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: x86_64-unknown-linux-gnu - override: true - default: true - - - name: Publish crate - run: cargo publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - - - diff --git a/.github/workflows/published_release.yml b/.github/workflows/published_release.yml deleted file mode 100644 index 16718a9..0000000 --- a/.github/workflows/published_release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Published release - -on: - release: - types: [published] - -jobs: - - checkout_code_and_cleanup: - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: true - - - name: Get version - id: get-version - run: echo ::set-output name=version::``$(echo ${{ github.event.release.tag_name }} | cut -dv -f2)`` - shell: bash - - - name: Delete release branch - run: git push -d origin release/${{ steps.get-version.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - publish_artifacts: - needs: checkout_code_and_cleanup - uses: ./.github/workflows/publish_artifacts.yml - with: - tag_name: ${{ github.event.release.tag_name }} - secrets: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..f941dbd --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,28 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + release-plz: + name: Release-plz + 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} \ No newline at end of file