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

ci: Support consecutive pre releases #308

Merged
merged 2 commits into from
Sep 5, 2024
Merged
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
19 changes: 17 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,32 @@ jobs:
if: ${{ steps.prep.outputs.tag_name == '' }}
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
run: |
if [ -z "${{ github.event.inputs.releaseType }}" ] && [ -z "${{ github.event.inputs.preReleaseFlavor }}" ];then
echo "No release type provided."
exit 1
fi

RELEASE_TYPE="${{ github.event.inputs.releaseType }}"

if [ -n "${{ github.event.inputs.preReleaseFlavor }}" ];then
PRE_RELEASE_ARGS="--preRelease=${{ github.event.inputs.preReleaseFlavor }} --github.preRelease"
LATEST_TAG=$(gh release list --limit 1 --json tagName --jq '.[] | .tagName')
# NOTE: Expected tag format is {VERSION}-{FLAVOR}.{FLAVOR_VERSION}
LATEST_FLAVOR=$(echo ${LATEST_TAG} | awk -F'-' '{ print $2 }' | awk -F'.' '{ print $1 }')

if [ "${LATEST_FLAVOR}" == "${{ github.event.inputs.preReleaseFlavor}}" ];then
# NOTE: If the inputted pre-release flavor matches the current pre-release flavor, we only
# want to increment the pre-release version instead of a full version bump.
PRE_RELEASE_ARGS="--preRelease"
RELEASE_TYPE=""
else
PRE_RELEASE_ARGS="--preRelease=${{ github.event.inputs.preReleaseFlavor }} --github.preRelease"
fi
fi

npx release-it ${{ github.event.inputs.releaseType }} ${PRE_RELEASE_ARGS}
npx release-it ${RELEASE_TYPE} ${PRE_RELEASE_ARGS}


release-windows-bundle:
runs-on: windows-latest
Expand Down
Loading