From 98ef7c829bce98dba2322a9c06c07c9c04345e83 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 21 Feb 2024 16:13:33 -0800 Subject: [PATCH] wip: add some workflows for backporting, semver, and publishing --- .github/workflows/backport.yml | 24 +++++++++++++++++++++ .github/workflows/publish.yml | 1 - .github/workflows/semver.yml | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/backport.yml diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 000000000..440bbc731 --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,24 @@ +# Attempt to backport a merged pull request to the latest stable release +# +# If the backported PR is succesfully merged + +name: Backport merged pull request +on: + pull_request_target: + types: [closed] + +permissions: + contents: write # so it can comment + pull-requests: write # so it can create pull requests + +jobs: + backport: + name: Backport pull request + runs-on: ubuntu-latest + + # Don't run on closed unmerged pull requests + if: github.event.pull_request.merged + steps: + - uses: actions/checkout@v4 + - name: Create backport pull requests + uses: korthout/backport-action@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f38670cc9..b111de50f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,7 +46,6 @@ jobs: # Release as-is # This assumes the version tracking PR has been merged - # cargo workspaces changed # # version will automatically commit back to the repo # # cargo workspaces version -y ${{ github.event.inputs.semver }} diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index 10dcff6c6..10121ed39 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -7,3 +7,41 @@ # Whenever a PR is made, we want to comment on it: # - semver compatibility # - if it's a fix, it should be backported to the minor update PR + +on: + push: + branches: + - master + +# Generate the minor bump +jobs: + update_routes: + runs-on: ubuntu-latest + steps: + # Check out the repo, but don't persist credentials, so github uses the GITHUB_TOKEN + - uses: actions/checkout@v2 + with: + persist-credentials: false + + # Run cargo workspaces version to generate the version bump PR + - run: "date > datetime.txt" # create or update a test.txt file + + # And then create the PR + - uses: gr2m/create-or-update-pull-request-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + title: "My pull request title" + body: "My pull request body" + branch: "my-pull-request-base-branch" + path: "lib/" + commit-message: "My commit message for uncommitted changes in lib/ folder" + author: "Lorem J. Ipsum " + labels: label1, label2 + assignees: user1, user2 + reviewers: user1, user2 + team_reviewers: team1, team2 + auto-merge: squash + update-pull-request-title-and-body: false + +# Generate the major bump