Skip to content

Commit

Permalink
cd: retrieve tag for current SHA and trigger GitHub release with this…
Browse files Browse the repository at this point in the history
… tag (#174)

* cd: retrieve tag for current SHA and trigger GitHub release with this tag
* docs: simplify release workflow description
  • Loading branch information
felix-seifert authored Jan 10, 2024
1 parent f88462d commit 5b3c7e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5b3c7e5

Please sign in to comment.