From c48ab7717e673149a5824aff0ad8553c7a5dfa9f Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Mon, 26 Aug 2024 14:17:06 +0200 Subject: [PATCH] Automatically create PRs to bump versions in ndc-postgres (#594) ### What This PR adds a `bump-version.yaml` workflow that can be manually triggered in the `Actions` tab. When triggered and given a new version of `ndc-postgres`, a PR will be generated that bumps `ndc-postgres` to that version. In practice, this means: * Updating the `Cargo.toml` file and associated lock file. * Moving everything in `changelog.md` from `Unreleased` to a section with the appropriate version title, and creating a new, blank `Unreleased` section. ### How GitHub actions, including a fancy new action we found to create pull requests against the repo. --- .github/workflows/bump-version.yaml | 33 +++++++++++++++++++++++++++++ .github/workflows/deploy.yaml | 21 ------------------ 2 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/bump-version.yaml delete mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml new file mode 100644 index 00000000..b72022ca --- /dev/null +++ b/.github/workflows/bump-version.yaml @@ -0,0 +1,33 @@ +on: + workflow_dispatch: + inputs: + new_version: + description: "What we want the new version to be" + required: true + +name: Bump version + +jobs: + bump_version_pr: + name: Create version bump PR + runs-on: ubuntu-latest + env: + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + steps: + - uses: actions/checkout@v4 + + - name: Install `just` + uses: extractions/setup-just@v2 + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "build" # share the cache across jobs + save-if: false + + - run: ./scripts/new-version.sh ${{ github.event.inputs.new_version }} + + # TODO: auto-merge when we feel confident. + - uses: peter-evans/create-pull-request@v6 + with: + title: Bump version to ${{ github.event.inputs.new_version }} + body: This bumps the version in `Cargo.toml` and updates `changelog.md`. diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index 45f6a484..00000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,21 +0,0 @@ -on: - workflow_dispatch: - inputs: - new_version: - description: "What we want the new version to be" - required: true - -name: Deploy process - -jobs: - deploy: - name: cargo audit - runs-on: ubuntu-latest - env: - CARGO_NET_GIT_FETCH_WITH_CLI: "true" - steps: - - uses: actions/checkout@v4 - - - run: ./scripts/new-version.sh ${{ github.event.inputs.new_version }} - - - run: cat Cargo.toml