From d5bf24885994bd7a99850090b4fcaf99c0815297 Mon Sep 17 00:00:00 2001 From: Reguel Wermelinger Date: Mon, 25 Nov 2024 16:37:03 +0100 Subject: [PATCH] automate release-drafter publishing - automatically publish new releases on new tags being created with semantic versions (v0.0.0) - separate release/trains via 'commitish' without actually requiring multiple drafter templates --- .github/workflows/draft-publisher.yml | 49 +++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 4 +-- .github/workflows/tag-publisher.yml | 29 ++++++++++++++++ README.md | 10 +++--- 4 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/draft-publisher.yml create mode 100644 .github/workflows/tag-publisher.yml diff --git a/.github/workflows/draft-publisher.yml b/.github/workflows/draft-publisher.yml new file mode 100644 index 00000000..b699cb9f --- /dev/null +++ b/.github/workflows/draft-publisher.yml @@ -0,0 +1,49 @@ +name: Release Publisher + +on: + workflow_call: + inputs: + publish: + required: false + default: true + type: boolean + version: + required: true + type: string + +permissions: + contents: read + +jobs: + publish_release: + permissions: + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - name: Set version env + run: | + RELEASE_VERSION="${{ inputs.version }}"; + if [ -z "$RELEASE_VERSION" ]; then + RELEASE_VERSION="${GITHUB_REF#refs/*/}" + fi; + echo RELEASE_VERSION=$RELEASE_VERSION >> $GITHUB_ENV + + MINOR=${RELEASE_VERSION%.*} + MINOR=${MINOR#v} + TARGET=release/${MINOR} + if [[ "${GITHUB_REF#refs/*/}" -eq "master" ]]; then + TARGET="master" + fi + echo RELEASE_TARGET=$TARGET >> $GITHUB_ENV + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + disable-autolabeler: true + name: ${{ env.RELEASE_VERSION }} + tag: ${{ env.RELEASE_VERSION }} + version: ${{ env.RELEASE_VERSION }} + commitish: ${{ env.RELEASE_TARGET }} + publish: ${{ inputs.publish }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 9d74a520..9921bf64 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -23,7 +23,7 @@ jobs: # Drafts your next Release notes as Pull Requests are merged into "release/12.0" - uses: release-drafter/release-drafter@v6 with: - # the drafter template lives on 'master', no need to add it to this release branch! - config-name: release-drafter-lts12.yml + config-name: release-drafter.yml + commitish: ${{ github.ref }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tag-publisher.yml b/.github/workflows/tag-publisher.yml new file mode 100644 index 00000000..801dba7a --- /dev/null +++ b/.github/workflows/tag-publisher.yml @@ -0,0 +1,29 @@ +name: Tag Publisher + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + tag: + type: string + description: the tag-ref to release e.g. 'v12.0.0' + publish: + type: boolean + default: false + description: publish the drafted release as final version? + + +permissions: + contents: write + pull-requests: read + +jobs: + build: + uses: ./.github/workflows/draft-pub.yml + with: + version: ${{ inputs.tag }} + # The 'publish' input parameter is used to control whether the release should be published automatically. + # Uncomment and set to 'false' if you want to prevent the release from being published immediately. + publish: ${{ inputs.publish == null && true || inputs.publish }} diff --git a/README.md b/README.md index 2058f436..f3864994 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,11 @@ mvn versions:set -DnewVersion=10.0.0-SNAPSHOT -DprocessAllModules -DgenerateBack Wait until the maven central release is available: this may take several hours until it's fully distributed. -- Publish the latest [draft release](https://github.com/axonivy/project-build-plugin/releases) do preserve the current changelog. - - Select the tag which was created for this release by the release-pipeline - - Verify that the title is correct - - Set the release as 'latest release' - - Publish it +- Release-Drafter changes, if a new-release train was introduced: + + - on github UI (PR View): flag the latest PR which was only merged to master with the label `major`. + ... now release-drafter action runs should create new draft PRs for the new release; without overwriting the existing master drafts. + - Raise project-build-plugin in other repos by triggering this [build](https://jenkins.ivyteam.io/view/jobs/job/github-repo-manager_raise-build-plugin-version/job/master/) - Merge the generated PRs on GitHub - If you prepared for a new release train: update the default engine version in the [AbstractEngineMojo](src/main/java/ch/ivyteam/ivy/maven/AbstractEngineMojo.java#L42)