Skip to content

chore: move CodeRabbit high-level summary to walkthrough #43

chore: move CodeRabbit high-level summary to walkthrough

chore: move CodeRabbit high-level summary to walkthrough #43

Workflow file for this run

name: Release
on:
pull_request:
types:
- closed
workflow_dispatch:
# Serialize releases so a manual dispatch and a merged-PR trigger cannot race
# between the tag-existence check and the publish steps.
concurrency:
group: release
cancel-in-progress: false
env:
ruby: '3.3.1'
xcode: '16.1'
jobs:
release:
name: Tag, publish to CocoaPods, and create GitHub Release
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/'))
runs-on: macos-14
environment: release
permissions:
contents: write
pull-requests: read
outputs:
version: ${{ steps.get_version.outputs.version }}
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Set up environment
uses: ./.github/actions/setup
with:
ruby: ${{ env.ruby }}
xcode: ${{ env.xcode }}
# Read the version from the single source of truth.
- name: Get version
id: get_version
run: |
version=$(awk -F'"' '/^[[:space:]]*let[[:space:]]+version[[:space:]]*=/ {print $2; exit}' Auth0/Version.swift)
if [[ -z "$version" ]]; then
echo "::error::Could not read version from Auth0/Version.swift"
exit 1
fi
echo "version=$version" >> $GITHUB_OUTPUT
# Detect a pre-release version so we can tag the GitHub Release
# accordingly. Any SemVer pre-release uses a hyphen separator (e.g.
# 1.0.0-beta.1, 2.0.0-rc.1). CocoaPods treats semver pre-release versions
# as pre-releases automatically, so no special pod tag is required.
- name: Get prerelease flag
id: get_prerelease
run: |
if [[ "${VERSION}" == *-* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
env:
VERSION: ${{ steps.get_version.outputs.version }}
# Abort if the tag already exists to avoid re-publishing a release.
- name: Check tag does not already exist
run: |
if git ls-remote --exit-code --tags origin "refs/tags/${VERSION}" >/dev/null 2>&1; then
echo "::error::Tag ${VERSION} already exists. Aborting release."
exit 1
fi
env:
VERSION: ${{ steps.get_version.outputs.version }}
# Pull the release notes from the body of the PR on the release/ branch.
- name: Get release notes
id: get_release_notes
uses: ./.github/actions/get-release-notes
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.get_version.outputs.version }}
repo_owner: ${{ github.repository_owner }}
repo_name: ${{ github.event.repository.name }}
# Tags the release, pushes the tag, lints the podspec, and pushes the pod
# to CocoaPods trunk.
- name: Run release lane
run: bundle exec fastlane release
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
# Create the GitHub Release from the pushed tag.
- name: Create GitHub Release
uses: ./.github/actions/release-create
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get_version.outputs.version }}
tag: ${{ steps.get_version.outputs.version }}
commit: ${{ github.sha }}
body: ${{ steps.get_release_notes.outputs.release-notes }}
prerelease: ${{ steps.get_prerelease.outputs.prerelease }}
# Build and deploy the versioned API documentation after a successful
# release. The actual build/deploy logic lives in docs.yml so it can also be
# dispatched manually against any branch to preview a deployment.
publish-docs:
needs: release
if: success()
uses: ./.github/workflows/docs.yml
permissions:
contents: write