Skip to content

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
94 changes: 92 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Release

on:
push:
branches:
Expand All @@ -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 }}
Copy link
Preview

Copilot AI Jun 3, 2025

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.

Suggested change
- if: ${{ steps.release.outputs }}
- if: ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}

Copilot uses AI. Check for mistakes.

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]+/)))")
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The 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.


# 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])")
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The 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
RELEASE_VERSION=$MAIN_RELEASE_VERSION-rc.$(node -e "console.log('$(git describe --tags --exclude rc*)'.split('-')[1])")
# Extract the number of commits ahead of the most recent non-release-candidate tag
GIT_DESCRIBE_OUTPUT=$(git describe --tags --exclude rc*)
COMMIT_COUNT=$(node -e "console.log('$GIT_DESCRIBE_OUTPUT'.split('-')[1])")
RELEASE_VERSION=$MAIN_RELEASE_VERSION-rc.$COMMIT_COUNT

Copilot uses AI. Check for mistakes.


# 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
14 changes: 7 additions & 7 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading