-
-
Notifications
You must be signed in to change notification settings - Fork 149
chore(deps): update all outdated dependencies, and update release flow for pushing RC releases #726
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,5 @@ | ||||||||||||
name: Release | ||||||||||||
|
||||||||||||
on: | ||||||||||||
push: | ||||||||||||
branches: | ||||||||||||
|
@@ -8,12 +10,100 @@ permissions: | |||||||||||
contents: write | ||||||||||||
pull-requests: write | ||||||||||||
|
||||||||||||
name: release-please | ||||||||||||
|
||||||||||||
jobs: | ||||||||||||
release-please: | ||||||||||||
runs-on: ubuntu-latest | ||||||||||||
steps: | ||||||||||||
- uses: googleapis/release-please-action@v4 | ||||||||||||
id: release | ||||||||||||
with: | ||||||||||||
target-branch: ${{ github.ref_name }} | ||||||||||||
|
||||||||||||
- uses: actions/checkout@v4 | ||||||||||||
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }} | ||||||||||||
with: | ||||||||||||
fetch-depth: 0 | ||||||||||||
|
||||||||||||
- if: ${{ steps.release.outputs }} | ||||||||||||
id: versions | ||||||||||||
run: | | ||||||||||||
set -ex | ||||||||||||
|
||||||||||||
RELEASE_CANDIDATE=true | ||||||||||||
NOT_RELEASE_CANDIDATE='${{ steps.release.outputs.release_created }}' | ||||||||||||
if [ "$NOT_RELEASE_CANDIDATE" = "true" ]; then | ||||||||||||
RELEASE_CANDIDATE=false | ||||||||||||
fi | ||||||||||||
|
||||||||||||
MAIN_RELEASE_VERSION=x | ||||||||||||
RELEASE_VERSION=y | ||||||||||||
|
||||||||||||
if [ "$RELEASE_CANDIDATE" = "true" ]; then | ||||||||||||
# Release please doesn't tell you the candidate version when it | ||||||||||||
# creates the PR, so we have to take it from the title. | ||||||||||||
MAIN_RELEASE_VERSION=$(node -e "console.log('${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).title }}'.split(' ').reverse().find(x => x.match(/[0-9]+[.][0-9]+[.][0-9]+/)))") | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The version extraction using a Node command is complex; consider adding error handling or refactoring this logic into a separate, more readable script to ensure a valid version string is always obtained. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||
|
||||||||||||
# Use git describe tags to identify the number of commits the branch | ||||||||||||
# is ahead of the most recent non-release-candidate tag, which is | ||||||||||||
# part of the rc.<commit> value. | ||||||||||||
RELEASE_VERSION=$MAIN_RELEASE_VERSION-rc.$(node -e "console.log('$(git describe --tags --exclude rc*)'.split('-')[1])") | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nested command substitution inside the Node command may reduce readability and complicate troubleshooting; consider refactoring this logic to improve clarity and maintainability.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||
|
||||||||||||
# release-please only ignores releases that have a form like [A-Z0-9]<version>, so prefixing with rc<version> | ||||||||||||
RELEASE_NAME="rc$RELEASE_VERSION" | ||||||||||||
else | ||||||||||||
MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} | ||||||||||||
RELEASE_VERSION="$MAIN_RELEASE_VERSION" | ||||||||||||
RELEASE_NAME="v$RELEASE_VERSION" | ||||||||||||
fi | ||||||||||||
|
||||||||||||
# Set environment variables | ||||||||||||
{ | ||||||||||||
echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" | ||||||||||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" | ||||||||||||
echo "RELEASE_CANDIDATE=${RELEASE_CANDIDATE}" | ||||||||||||
echo "RELEASE_NAME=${RELEASE_NAME}" | ||||||||||||
} >> "${GITHUB_ENV}" | ||||||||||||
|
||||||||||||
# Set step outputs | ||||||||||||
{ | ||||||||||||
echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" | ||||||||||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" | ||||||||||||
echo "RELEASE_CANDIDATE=${RELEASE_CANDIDATE}" | ||||||||||||
echo "RELEASE_NAME=${RELEASE_NAME}" | ||||||||||||
} >> "${GITHUB_OUTPUT}" | ||||||||||||
|
||||||||||||
- name: Create GitHub release and branches | ||||||||||||
if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }} | ||||||||||||
run: | | ||||||||||||
set -ex | ||||||||||||
|
||||||||||||
if [ "$RELEASE_CANDIDATE" = "true" ]; then | ||||||||||||
PR_NUMBER='${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).number }}' | ||||||||||||
|
||||||||||||
# Create release candidate | ||||||||||||
GH_TOKEN='${{ secrets.GITHUB_TOKEN }}' gh release \ | ||||||||||||
create "$RELEASE_NAME" \ | ||||||||||||
--title "v$RELEASE_VERSION" \ | ||||||||||||
--prerelease \ | ||||||||||||
-n "This is a release candidate. See release-please PR #$PR_NUMBER for context." | ||||||||||||
|
||||||||||||
# Comment on PR | ||||||||||||
GH_TOKEN='${{ secrets.GITHUB_TOKEN }}' gh pr comment "$PR_NUMBER" \ | ||||||||||||
-b "Release candidate [v$RELEASE_VERSION](https://github.com/supabase/supabase-swift/releases/tag/$RELEASE_NAME) published." | ||||||||||||
else | ||||||||||||
if [ "$GITHUB_REF" == "refs/heads/main" ] || [ "$GITHUB_REF" == "refs/heads/master" ]; then | ||||||||||||
IS_PATCH_ZERO=$(node -e "console.log('$RELEASE_VERSION'.endsWith('.0'))") | ||||||||||||
|
||||||||||||
if [ "$IS_PATCH_ZERO" == "true" ]; then | ||||||||||||
# Only create release branch if patch version is 0, as this | ||||||||||||
# means that the release can be patched in the future. | ||||||||||||
GH_TOKEN='${{ secrets.GITHUB_TOKEN }}' gh api \ | ||||||||||||
--method POST \ | ||||||||||||
-H "Accept: application/vnd.github+json" \ | ||||||||||||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||||||||||||
/repos/supabase/supabase-swift/git/refs \ | ||||||||||||
-f "ref=refs/heads/release/${RELEASE_VERSION}" \ | ||||||||||||
-f "sha=$GITHUB_SHA" | ||||||||||||
fi | ||||||||||||
fi | ||||||||||||
fi |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition is too generic; consider using an explicit check (e.g. for specific output variables) to ensure the step only runs when the expected outputs (like 'release_created' or 'prs_created') are set.
Copilot uses AI. Check for mistakes.