From 58b0abbc2b64a9283bd6a7ae91bedfb35169c98d Mon Sep 17 00:00:00 2001 From: Felix Seifert Date: Tue, 9 Jan 2024 08:06:40 +0100 Subject: [PATCH 1/2] cd: retrieve tag for current SHA and trigger GitHub release with this tag --- .github/workflows/release.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b98ebdd0..267033d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,10 +46,27 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - trigger-github-release: + get-tag-of-current-sha: needs: build + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag-retriever.outputs.tag }} + # Var is empty if command to retrieve tag fails (e.g. if current SHA has no tag associated) + steps: + + - uses: actions/checkout@v4 + + - name: Store tag of SHA if present + id: tag-retriever + run: | + echo "tag=$(git describe --exact-match ${{ github.sha }})" >> "$GITHUB_OUTPUT" + + + trigger-github-release: + needs: get-tag-of-current-sha name: Trigger GitHub release workflow - if: github.ref_type == 'tag' + if: needs.get-tag-of-current-sha.outputs.tag + # Runs job only if tag is present. uses: ./.github/workflows/release-on-github.yml with: - tag: ${{ github.ref_name }} + tag: ${{ needs.get-tag-of-current-sha.outputs.tag }} From 3d80a88b281a0bd05b27fbc28d9105d6134919a6 Mon Sep 17 00:00:00 2001 From: Felix Seifert Date: Tue, 9 Jan 2024 08:32:29 +0100 Subject: [PATCH 2/2] docs: simplify release workflow description --- README.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ce9ff616..73f55abb 100644 --- a/README.md +++ b/README.md @@ -104,22 +104,16 @@ This project uses Maven. To run the tests locally, just run: mvn clean verify ``` -If you are a maintainer, you can release a new version by doing the following: - -- Trigger the workflow [prepare-release](./.github/workflows/prepare-release.yml) through the - [web UI](https://github.com/spotify/github-java-client/actions/workflows/prepare-release.yml) - - Select whether the new release should be a `major`, `minor` or `patch` release - - Trigger the release preparation on the `master` branch - - Pushes of this workflow will trigger runs of the workflow - [release](https://github.com/spotify/github-java-client/actions/workflows/release.yml) -- Once the - [release pipeline](https://github.com/spotify/github-java-client/actions/workflows/release.yml) - has completed for the release tag, the new release will be available on Maven Central and the - changes can be released on GitHub -- [Navigate to the tag](https://github.com/spotify/github-java-client/tags) associated with the - changes and generate a manual release -- Once the release is generated, select the "Set as the latest release" checkbox and publish the - release +If you are a maintainer, you can release a new version by just triggering the workflow +[prepare-release](./.github/workflows/prepare-release.yml) through the +[web UI](https://github.com/spotify/github-java-client/actions/workflows/prepare-release.yml). +- Select whether the new release should be a `major`, `minor` or `patch` release +- Trigger the release preparation on the `master` branch +- Pushes of this workflow will trigger runs of the + [maven-release](https://github.com/spotify/github-java-client/actions/workflows/release.yml) + workflow, which in turn will trigger the + [github-release](https://github.com/spotify/github-java-client/actions/workflows/release-on-github.yml) + workflow with the automatically created tag ## Notes about maturity