From 112e90efc09f8d5a58b93ec4a32a847c726418d1 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Fri, 16 Aug 2024 14:12:30 -0500 Subject: [PATCH] Add workflow that only bumps the crates version --- .github/workflows/bump-version.yml | 68 +++++++++++++++++++++++++ .github/workflows/create-release-pr.yml | 46 ----------------- 2 files changed, 68 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/bump-version.yml delete mode 100644 .github/workflows/create-release-pr.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000000..56a264f7f7 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,68 @@ +name: Bump version for release + +on: + workflow_dispatch: + inputs: + level: + description: | + Select the level of the release + required: true + type: choice + options: + - minor + - patch + +jobs: + bump-version: + permissions: + id-token: write + pull-requests: write + contents: write + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Configure gitsign + uses: chainguard-dev/actions/setup-gitsign@main + + - name: Install cargo-release + uses: taiki-e/install-action@v1 + with: + tool: cargo-release + + - name: Install sd + uses: taiki-e/install-action@v1 + with: + tool: sd + + - name: Install npm + uses: actions/setup-node@v4 + + - name: Install doctoc + run: npm install doctoc + + - name: Bump version + run: | + cargo release version ${{ inputs.level }} --execute --no-confirm + + - name: Extract version + run: | + echo "version=$(cargo pkgid -p bindgen | cut -d '#' -f 2)" >> $GITHUB_ENV + + - name: Update changelog + run: | + sd "# Unreleased" "# Unreleased\n## Added\n## Changed\n## Removed\n## Fixed\n## Security\n\n# ${{ env.version }} ($(date -I))" CHANGELOG.md + ./node_modules/doctoc/doctoc.js CHANGELOG.md + + - name: Create PR + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: bump-version/${{ env.version }} + base: main + commit-message: "Bump crates version to ${{ env.version }}" + title: "Bump crates version to ${{ env.version }}" + body: | + This pull request was created automatically by GitHub Actions. diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml deleted file mode 100644 index 59b7090c13..0000000000 --- a/.github/workflows/create-release-pr.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Create release PR - -on: - workflow_dispatch: - inputs: - level: - description: | - Select the level of the release: - - minor: Increase the minor version (x.y.0) - - patch: Increase the patch version (x.y.z) - required: true - type: choice - options: - - minor - - patch - -jobs: - create-release-pr: - permissions: - id-token: write # Enable OIDC - pull-requests: write - contents: write - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Configure gitsign - uses: chainguard-dev/actions/setup-gitsign@main - - - name: Install `cargo-release` - uses: taiki-e/install-action@v1 - with: - tool: cargo-release - - - name: Install `npm` - uses: actions/setup-node@v4 - - - name: Install `doctoc` - run: npm install doctoc - - - name: Create a release pull request - uses: cargo-bins/release-pr@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - version: ${{ github.event.inputs.level }}