Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inner-releases-as-latest option #9

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ Then continue creating `vX.Y.Z` releases as usual, related existing `vX` and `vX
> [!IMPORTANT]
> Will work only on pre-existing releases !

- `inner-releases-as-latest`: Default to `auto`.

Whether to set inner releases as latest.

> [!IMPORTANT]
> Requires `update-inner-releases` at `true` !

- `auto`: Will be set only if releases linked to provided `tag` is the latest
- `true`: Set them as latest whatever if provided `tag` release is the latest or not
- `false`: Do not set them as latest

- `git-email`: Default to `github-actions[bot]@users.noreply.github.com`.

_Git user email is required when creating tag with a message._
Expand Down
18 changes: 13 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@
default: ${{ github.event.release.tag_name }}
update-inner-releases:
description: |
Whether to also update releases name linked to `vX` and `vX.Y` tags and set them as latest if provided tag
release is currently the latest release.
Whether to also update releases name linked to `vX` and `vX.Y` tags.
Will work only on pre-existing releases !
required: false
default: 'false'
inner-releases-as-latest:
description: |
Whether to set inner releases as latest. Requires `update-inner-releases` at `true` !
- `auto`: Will be set only if releases linked to provided `tag` is the latest
- `true`: Set as latest whatever provided `tag` releases is the latest or not
- `false`: Do not set them as latest
required: false
default: 'auto'
git-email:
description: The email for the GIT user creating the tags
required: false
Expand Down Expand Up @@ -126,17 +133,18 @@
FULL_TAG: ${{ inputs.tag }}
MINOR_TAG: ${{ steps.generate-tags.outputs.minor }}
MAJOR_TAG: ${{ steps.generate-tags.outputs.major }}
LATEST_MODE: ${{ inputs.inner-releases-as-latest }}
working-directory: ${{ inputs.working-directory }}
run: |
# Update inner releases
MINOR_RELEASE_EXISTS=$( (gh release view "${MINOR_TAG}" --json id -q .id | wc -l | tr -d '[:space:]') || echo 0);
MAJOR_RELEASE_EXISTS=$( (gh release view "${MAJOR_TAG}" --json id -q .id | wc -l | tr -d '[:space:]') || echo 0);
MINOR_RELEASE_EXISTS=$( (gh release view "${MINOR_TAG}" --json id -q .id | wc -l |tr -d '[:space:]') || echo 0);
MAJOR_RELEASE_EXISTS=$( (gh release view "${MAJOR_TAG}" --json id -q .id | wc -l |tr -d '[:space:]') || echo 0);
if [[ "${MINOR_RELEASE_EXISTS}${MAJOR_RELEASE_EXISTS}" -eq 0 ]]; then
echo '::warning::No inner release to update !'
exit 0
fi
PARAMS="--title ${FULL_TAG}"
if [[ "`gh repo view --json latestRelease -q .latestRelease.tagName`" = "${FULL_TAG}" ]]; then
if [[ "${LATEST_MODE}" = "true" || ( "${LATEST_MODE}" = "auto" && "`gh repo view --json latestRelease -q .latestRelease.tagName`" = "${FULL_TAG}" ) ]]; then

Check warning on line 147 in action.yml

View workflow job for this annotation

GitHub Actions / Static tests

147:121 [line-length] line too long (164 > 120 characters)
PARAMS+=' --latest'
fi
if ! [[ "${MINOR_RELEASE_EXISTS}" -eq 0 ]]; then
Expand Down