-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Automate release process with release please (#72)
- Loading branch information
Showing
15 changed files
with
347 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Build Documentation | ||
description: 'Build Documentation.' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install jazzy gem | ||
shell: bash | ||
run: gem install jazzy | ||
|
||
- name: Build Documentation | ||
shell: bash | ||
run: jazzy -o docs | ||
|
||
- name: Validate coverage | ||
shell: bash | ||
run: | | ||
FULLDOC=`jq '.warnings | length == 0' docs/undocumented.json` | ||
[ $FULLDOC == "true" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This is a composite to allow sharing these steps into other workflows. | ||
# For instance it could be used by regular CI as well as the release process. | ||
|
||
name: CI Workflow | ||
description: 'Shared CI workflow.' | ||
inputs: | ||
xcode-version: | ||
description: 'Which version of xcode should be installed' | ||
required: true | ||
ios-sim: | ||
description: 'iOS Simulator to use for testing' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd | ||
with: | ||
xcode-version: ${{ inputs.xcode-version }} | ||
|
||
- name: Install mint | ||
shell: bash | ||
run: | | ||
brew tap mint-lang/mint-lang | ||
brew install mint-lang | ||
- name: Install cocoapods | ||
shell: bash | ||
run: gem install cocoapods | ||
|
||
- name: Lint the podspec | ||
shell: bash | ||
run: pod spec lint LDSwiftEventSource.podspec | ||
|
||
- name: Build & Test on macOS Simulator | ||
shell: bash | ||
run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk macosx -destination 'platform=macOS' | xcpretty | ||
|
||
- name: Build for ARM64 macOS | ||
shell: bash | ||
run: xcodebuild build -scheme 'LDSwiftEventSource' -arch arm64e -sdk macosx | xcpretty | ||
|
||
- name: Build Tests for iOS device | ||
shell: bash | ||
run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk iphoneos CODE_SIGN_IDENTITY= | xcpretty | ||
|
||
- name: Build & Test on iOS Simulator | ||
shell: bash | ||
run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk iphonesimulator -destination '${{ inputs.ios-sim }}' CODE_SIGN_IDENTITY= | xcpretty | ||
|
||
- name: Build Tests for tvOS device | ||
shell: bash | ||
run: xcodebuild build-for-testing -scheme 'LDSwiftEventSource' -sdk appletvos CODE_SIGN_IDENTITY= | xcpretty | ||
|
||
- name: Build & Test on tvOS Simulator | ||
shell: bash | ||
run: xcodebuild test -scheme 'LDSwiftEventSource' -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty | ||
|
||
- name: Build for watchOS simulator # No XCTest testing on watchOS | ||
shell: bash | ||
run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchsimulator | xcpretty | ||
|
||
- name: Build for watchOS device # No XCTest testing on watchOS | ||
shell: bash | ||
run: xcodebuild build -scheme 'LDSwiftEventSource' -sdk watchos | xcpretty | ||
|
||
- name: Build & Test with swiftpm | ||
shell: bash | ||
run: swift test -v 2>&1 | xcpretty | ||
|
||
- name: Run contract tests | ||
shell: bash | ||
run: make contract-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Publish Documentation | ||
description: 'Publish the documentation to GitHub pages' | ||
inputs: | ||
token: | ||
description: 'Token to use for publishing.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: launchdarkly/gh-actions/actions/[email protected] | ||
name: 'Publish to GitHub pages' | ||
with: | ||
docs_path: docs | ||
github_token: ${{ inputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Publish Package | ||
description: 'Publish the package to Cocoapods' | ||
inputs: | ||
dry_run: | ||
description: 'Is this a dry run. If so no package will be published.' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Push to cocoapods | ||
if: ${{ inputs.dry_run == 'false' }} | ||
shell: bash | ||
run: pod trunk push LDSwiftEventSource.podspec --allow-warnings --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Update xcode project version numbers | ||
description: 'Update xcode project version numbers' | ||
inputs: | ||
branch: | ||
description: 'The branch to checkout and push updates to' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
|
||
- name: Calculate version numbers | ||
id: version | ||
shell: bash | ||
run: | | ||
version=$(jq -r '."."' .release-please-manifest.json) | ||
major=$(echo "$version" | cut -f1 -d.) | ||
minor=$(echo "$version" | cut -f2 -d.) | ||
patch=$(echo "$version" | cut -f3 -d.) | ||
# 64 + version gives us a letter offset for the framework version. | ||
framework=$(echo $((major + 64)) | awk '{ printf("%c", $1) }') | ||
echo "major=${major}" >> "$GITHUB_OUTPUT" | ||
echo "minor=${minor}" >> "$GITHUB_OUTPUT" | ||
echo "patch=${patch}" >> "$GITHUB_OUTPUT" | ||
echo "framework=${framework}" >> "$GITHUB_OUTPUT" | ||
- name: Update other version numbers | ||
shell: bash | ||
run: | | ||
sed -i .bak -E \ | ||
-e 's/MARKETING_VERSION = [^;]+/MARKETING_VERSION = ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}/' \ | ||
-e 's/DYLIB_CURRENT_VERSION = [^;]+/DYLIB_CURRENT_VERSION = ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}/' \ | ||
-e 's/DYLIB_COMPATIBILITY_VERSION = [^;]+/DYLIB_COMPATIBILITY_VERSION = ${{ steps.version.outputs.major }}.0.0/' \ | ||
-e 's/FRAMEWORK_VERSION = .*/FRAMEWORK_VERSION = ${{ steps.version.outputs.framework }};/' \ | ||
LDSwiftEventSource.xcodeproj/project.pbxproj | ||
sed -i .bak -E \ | ||
-e "s/pod 'LDSwiftEventSource', '~> [0-9]+.[0-9]+'/pod 'LDSwiftEventSource', '~> ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}'/" \ | ||
-e "s/github \"LaunchDarkly\/swift-eventsource\" ~> [0-9]+.[0-9]+/github \"LaunchDarkly\/swift-eventsource\" ~> ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}/" README.md | ||
rm -f LDSwiftEventSource.xcodeproj/project.pbxproj.bak README.md.bak | ||
if [ $(git status --porcelain | wc -l) -gt 0 ]; then | ||
git config --global user.name 'LaunchDarklyReleaseBot' | ||
git config --global user.email '[email protected]' | ||
git add LDSwiftEventSource.xcodeproj/project.pbxproj | ||
git add README.md | ||
git commit -m 'Updating generated project and readme files' | ||
git push | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Lint PR title | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
lint-pr-title: | ||
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
name: Publish Documentation | ||
jobs: | ||
build-publish: | ||
runs-on: macos-13 | ||
|
||
permissions: | ||
id-token: write # Needed if using OIDC to get release secrets. | ||
contents: write # Needed in this case to write github pages. | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build and Test | ||
uses: ./.github/actions/ci | ||
with: | ||
xcode-version: 14.3.1 | ||
ios-sim: 'platform=iOS Simulator,name=iPhone 16,OS=16.4' | ||
|
||
- uses: ./.github/actions/build-docs | ||
|
||
- uses: ./.github/actions/publish-docs | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish Package | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dry_run: | ||
description: 'Is this a dry run. If so no package will be published.' | ||
type: boolean | ||
required: true | ||
|
||
jobs: | ||
build-publish: | ||
runs-on: macos-13 | ||
|
||
# Needed to get tokens during publishing. | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: launchdarkly/gh-actions/actions/[email protected] | ||
name: 'Get Cocoapods token' | ||
with: | ||
aws_assume_role: ${{ vars.AWS_ROLE_ARN }} | ||
ssm_parameter_pairs: '/production/common/releasing/cocoapods/token = COCOAPODS_TRUNK_TOKEN' | ||
|
||
- uses: ./.github/actions/ci | ||
with: | ||
xcode-version: 14.3.1 | ||
ios-sim: 'platform=iOS Simulator,name=iPhone 16,OS=16.4' | ||
|
||
- uses: ./.github/actions/publish | ||
with: | ||
dry_run: ${{ inputs.dry_run }} |
Oops, something went wrong.