diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47044d0e..77556aac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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]+/)))") + + # 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. value. + RELEASE_VERSION=$MAIN_RELEASE_VERSION-rc.$(node -e "console.log('$(git describe --tags --exclude rc*)'.split('-')[1])") + + # release-please only ignores releases that have a form like [A-Z0-9], so prefixing with rc + 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 \ No newline at end of file diff --git a/Package.resolved b/Package.resolved index 8f565183..45ffce15 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-asn1.git", "state" : { - "revision" : "ae33e5941bb88d88538d0a6b19ca0b01e6c76dcf", - "version" : "1.3.1" + "revision" : "a54383ada6cecde007d374f58f864e29370ba5c3", + "version" : "1.3.2" } }, { @@ -57,10 +57,10 @@ { "identity" : "swift-http-types", "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-http-types", + "location" : "https://github.com/apple/swift-http-types.git", "state" : { - "revision" : "ef18d829e8b92d731ad27bb81583edd2094d1ce3", - "version" : "1.3.1" + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" } }, { @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swiftlang/swift-syntax", "state" : { - "revision" : "0687f71944021d616d34d922343dcef086855920", - "version" : "600.0.1" + "revision" : "f99ae8aa18f0cf0d53481901f88a0991dc3bd4a2", + "version" : "601.0.1" } }, { diff --git a/Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved index d0804396..8abd010f 100644 --- a/Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/clerk/clerk-ios", "state" : { - "revision" : "1ab675fa2551729016b5f222c8c161e0cff1b366", - "version" : "0.52.0" + "revision" : "0a5f0052b00d60d8144c261748929757a6b94952", + "version" : "0.57.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/hmlongco/Factory", "state" : { - "revision" : "fb04a8918848e413d3921d346a23bae7f81088d9", - "version" : "2.4.3" + "revision" : "ccc898f21992ebc130bc04cc197460a5ae230bcf", + "version" : "2.5.3" } }, { @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/auth0/SimpleKeychain", "state" : { - "revision" : "b694f155907b189bc82e93586695a26f558c742f", - "version" : "1.2.0" + "revision" : "776c4a6db74d5c6c143974be91c383680d468630", + "version" : "1.3.0" } }, { @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-asn1.git", "state" : { - "revision" : "ae33e5941bb88d88538d0a6b19ca0b01e6c76dcf", - "version" : "1.3.1" + "revision" : "a54383ada6cecde007d374f58f864e29370ba5c3", + "version" : "1.3.2" } }, { @@ -104,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-case-paths", "state" : { - "revision" : "19b7263bacb9751f151ec0c93ec816fe1ef67c7b", - "version" : "1.6.1" + "revision" : "41b89b8b68d8c56c622dbb7132258f1a3e638b25", + "version" : "1.7.0" } }, { @@ -122,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections", "state" : { - "revision" : "671108c96644956dddcd89dd59c203dcdb36cec7", - "version" : "1.1.4" + "revision" : "c1805596154bb3a265fd91b8ac0c4433b4348fb0", + "version" : "1.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "45305d32cfb830faebcaa9a7aea66ad342637518", - "version" : "3.11.1" + "revision" : "e8d6eba1fef23ae5b359c46b03f7d94be2f41fed", + "version" : "3.12.3" } }, { @@ -158,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-http-types.git", "state" : { - "revision" : "ef18d829e8b92d731ad27bb81583edd2094d1ce3", - "version" : "1.3.1" + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" } }, { @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-snapshot-testing", "state" : { - "revision" : "b2d4cb30735f4fbc3a01963a9c658336dd21e9ba", - "version" : "1.18.1" + "revision" : "37230a37e83f1b7023be08e1b1a2603fcb1567fb", + "version" : "1.18.4" } }, { @@ -185,8 +185,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swiftlang/swift-syntax", "state" : { - "revision" : "0687f71944021d616d34d922343dcef086855920", - "version" : "600.0.1" + "revision" : "f99ae8aa18f0cf0d53481901f88a0991dc3bd4a2", + "version" : "601.0.1" } }, { @@ -203,8 +203,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "b444594f79844b0d6d76d70fbfb3f7f71728f938", - "version" : "1.5.1" + "revision" : "39de59b2d47f7ef3ca88a039dff3084688fe27f4", + "version" : "1.5.2" } } ],