Skip to content

Commit

Permalink
Migrate Release Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaafanador3 committed Nov 29, 2023
1 parent 95cb711 commit 4b10ed7
Show file tree
Hide file tree
Showing 10 changed files with 1,196 additions and 180 deletions.
216 changes: 216 additions & 0 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
name: Prepare Release
on:
push:
branches:
- "dp/migration_release_pipeline"
jobs:
prepare:
runs-on: ubuntu-latest
name: Create Draft Release to store artifacts
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export GITHUB_TOKEN to workspace
run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Install ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1.2'
- name: Install Gems
run: |
gem install octokit
- name: Create draft release to store artifacts.
run: ruby ./scripts/github_release.rb create-draft-release
build-docs:
runs-on: ubuntu-latest
name: Package docs and upload them to the draft release
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Run release_package-docs xcode cloud build and wait for it to finish, this xcode cloud upload realm-docs.zip assets to the artifacts draft release
run: |
XCODE_VERSION="$(ruby ./scripts/release-matrix.rb docs_version)"
ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow "release_package-docs_${XCODE_VERSION}" --token ${{ steps.token.outputs.token }}
build-examples:
runs-on: macos-latest
name: Package examples and upload them to the draft release
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export GITHUB_TOKEN to workspace
run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Install ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.1.2'
- name: Install Gems
run: |
gem install octokit
gem install xcodeproj
- name: Run release_package-examples package and uploads the example folder
run: ./build.sh release_package-examples
build-product:
runs-on: ubuntu-latest
name: Package product for each xcode version.
needs: build-examples
strategy:
matrix:
xcode-version: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Run release_package_${{ matrix.xcode-version }} which upload the package to the draft release and wait for it to complete or fail
run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow "release_package_${{ matrix.xcode-version }}" --token ${{ steps.token.outputs.token }}
test-package-examples:
runs-on: ubuntu-latest
name: Test examples, using the packages releases
needs: build-product
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Run release_test-package-examples_15.1 which runs test over the packages produces by the previous step and wait for it to complete or fail
run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow release_test-package-examples_15.1 --token ${{ steps.token.outputs.token }}
test-ios-static:
runs-on: ubuntu-latest
name: Run tests on iOS with configuration Static
needs: build-product
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Run release_ios-static_15.1 which runs test over the packages produces by the previous step and wait for it to complete or fail
run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow release_test-ios-static_15.1 --token ${{ steps.token.outputs.token }}
test-osx-static:
runs-on: ubuntu-latest
name: Run tests on macOS
needs: build-product
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Run release_osx_15.1 which runs test over the packages produces by the previous step and wait for it to complete or fail
run: ruby ./scripts/xcode_cloud_helper.rb --run-release-workflow release_test-osx_15.1 --token ${{ steps.token.outputs.token }}
test-installation:
runs-on: ubuntu-latest
name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }}
needs: build-product
env:
XCODE_VERSION: '14.3.1'
strategy:
matrix:
platform: [ios, osx, watchos, tvos, catalyst]
installation: [cocoapods, spm, carthage, xcframework]
linkage: [static, dynamic]
exclude:
- platform: catalyst
installation: carthage
- installation: carthage
linkage: static
- platform: osx
installation: xcframework
linkage: static
- platform: watchos
installation: xcframework
linkage: static
- platform: tvos
installation: xcframework
linkage: static
- platform: catalyst
installation: xcframework
linkage: static
- platform: osx
installation: xcframework
linkage: dynamic
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Export REALM_TEST_BRANCH
run: echo "REALM_TEST_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Creates an XCode Cloud workflow to run the test and runs build
run: |
ruby ./scripts/xcode_cloud_helper.rb --create-release-workflow-and-run test-installation-${{ matrix.platform }}-${{ matrix.installation }}-${{ matrix.linkage }} --xcode-version "$XCODE_VERSION" --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }}
test-installation-xcode:
runs-on: ubuntu-latest
name: Run installation test on macOS only for for xcframework for all ${{ matrix.xcode_version }}
needs: build-product
strategy:
matrix:
xcode_version: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Export REALM_TEST_BRANCH
run: echo "REALM_TEST_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Creates an XCode Cloud workflow to run the test and runs build
run: |
ruby ./scripts/xcode_cloud_helper.rb --create-release-workflow-and-run test-installation-osx-xcframework-dynamic --xcode-version ${{ matrix.xcode_version }} --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }}
174 changes: 174 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Publish release
on: workflow_dispatch
jobs:
prepare:
runs-on: macos-latest
name: Check if draft release is created
steps:
- name: Get draft release
id: get_release
uses: agners/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
tag-release:
runs-on: macos-latest
name: Tag Release
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Tag release
run: ./build.sh publish-tag ${{ steps.extract_branch.outputs.branch }}
publish-docs:
runs-on: macos-latest
name: Publish docs to S3 Bucket
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export AWS Secrets to workspace
run: |
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV
- name: Download docs and upload them to S3
run: |
./build.sh publish-docs
create-release:
runs-on: macos-latest
name: Create github release
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export GITHUB_TOKEN to workspace
run: echo "GITHUB_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Create Github release
run: ./build.sh publish-github
publish-cocoapods:
runs-on: macos-latest
name: Publish Cocoapods specs
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read SDK version
id: get-version
run: |
version="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${source_root}/dependencies.list")"pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Export COCOAPODS_TRUNK_TOKEN to workspace
run: echo "COCOAPODS_TRUNK_TOKEN=${{ secrets.COCOAPODS_TRUNK_TOKEN }}" >> $GITHUB_ENV
- name: Publish
run: ./build.sh publish-cocoapods v${{ steps.get-version.outputs.version }}
update-update-checker:
runs-on: macos-latest
name: Publish Cocoapods specs
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Export AWS Secrets to workspace
run: |
echo "AWS_ACCESS_KEY_ID=${{ secrets.UPDATE_CHECKER_ACCESS_KEY }}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.UPDATE_CHECKER_SECRET_KEY }}" >> $GITHUB_ENV
- name: Create Github release
run: ./build.sh publish-update-checker
test-installation:
runs-on: ubuntu-latest
name: Run installation test for ${{ matrix.platform }}, ${{ matrix.installation }} and ${{ matrix.linkage }}
needs: update-update-checker
env:
XCODE_VERSION: '15.1'
strategy:
matrix:
platform: [ios, osx, watchos, tvos, catalyst, visionos]
installation: [cocoapods, spm, carthage, xcframework]
linkage: [static, dynamic]
exclude:
- installation: carthage
linkage: static
- platform: osx
installation: xcframework
linkage: static
- platform: watchos
installation: xcframework
linkage: static
- platform: tvos
installation: xcframework
linkage: static
- platform: catalyst
installation: xcframework
linkage: static
- platform: visionos
installation: xcframework
linkage: static
- platform: catalyst
installation: carthage
linkage: static
- platform: visionos
installation: carthage
- platform: visionos
installation: cocoapods
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Token
id: token
uses: yuki0n0/[email protected]
with:
# UUID. Can get from App Store Connect.
issuer id: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
# Key ID. Can get from App Store Connect.
key id: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
# P8 private key. Can get from App Store Connect.
key: ${{ secrets.APPLE_STORE_CONNECT_API_KEY }}
- name: Read SDK version
id: get-version
run: |
version="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${source_root}/dependencies.list")"pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Export REALM_TEST_RELEASE
run: echo "REALM_TEST_RELEASE=${{ steps.get-version.outputs.version }}" >> $GITHUB_ENV
- name: Creates an XCode Cloud workflow to run the test and runs build
run: |
ruby ./scripts/xcode_cloud_helper.rb --create-release-workflow-and-run test-installation-${{ matrix.platform }}-${{ matrix.installation }}-${{ matrix.linkage }} --xcode-version "$XCODE_VERSION" --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }}
post-slack-release:
runs-on: macos-latest
name: Publish to release Slack channel
needs: test-installation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare Changelog
run: ./build.sh prepare-publish-changelog
- name: Read SDK version
id: get-version
run: |
version="$(sed -n 's/^VERSION=\(.*\)$/\1/p' "${source_root}/dependencies.list")"pkgVersion=$(find . -type f -regex ".*Realm.[1-9].*.nupkg" -exec basename {} \; | sed -n 's/Realm\.\(.*\)\.nupkg$/\1/p')
echo "version=$version" >> $GITHUB_OUTPUT
- name: 'Post to #realm-releases'
uses: realm/ci-actions/release-to-slack@v3
with:
changelog: ExtractedChangelog/CHANGELOG.md
sdk: Swift
webhook-url: ${{ secrets.SLACK_RELEASE_WEBHOOK }}
version: ${{ steps.get-version.outputs.version }}
add-empty-changelog:
runs-on: macos-latest
name: Add empty changelog and push it to master, preparing for a future release
needs: post-slack-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add empty changelog
run: ./build.sh add-empty-changelog
- name: Commit & Push changes to master
uses: actions-js/push@master
with:
github_token: ${{ github.token }}


Loading

0 comments on commit 4b10ed7

Please sign in to comment.