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 28, 2023
1 parent 95cb711 commit 2e73578
Show file tree
Hide file tree
Showing 9 changed files with 1,129 additions and 166 deletions.
180 changes: 180 additions & 0 deletions .github/workflows/master-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
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: prepare
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 on each xcode version
needs: build-product
env:
XCODE_VERSION: '15.1'
strategy:
matrix:
platform: ['ios', 'osx', 'watchos', 'tvos', 'catalys', 'visionos']
installation: ['cocoapods', 'spm', 'carthage', 'xcframework']
linkage: ['static', 'dynamic']
exclude:
- installation: cartage
linkage: static
- platform: ['osx', 'watchos', 'tvos', 'catalys', 'visionos']
installation: xcframework
linkage: static
- platform: catalyst
installation: carthage
linkage: static
- platform: visionos
installation: ['carthage', '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: 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.platform }}-${{ matrix.linkage }} --xcode-version "$XCODE_VERSION" --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }}
165 changes: 165 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
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 on each xcode version
needs: update-update-checker
env:
XCODE_VERSION: '15.1'
strategy:
matrix:
platform: ['ios', 'osx', 'watchos', 'tvos', 'catalys', 'visionos']
installation: ['cocoapods', 'spm', 'carthage', 'xcframework']
linkage: ['static', 'dynamic']
exclude:
- installation: cartage
linkage: static
- platform: ['osx', 'watchos', 'tvos', 'catalys', 'visionos']
installation: xcframework
linkage: static
- platform: catalyst
installation: carthage
linkage: static
- platform: visionos
installation: ['carthage', '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: Creates an XCode Cloud workflow to run the test
run: |
workflow_id="$(ruby ./scripts/xcode_cloud_helper.rb --create-workflow release_test-installation-${{ matrix.platform }}-${{ matrix.platform }}-${{ matrix.linkage }} --xcode-version $XCODE_VERSION --token ${{ steps.token.outputs.token }} --team-id ${{ secrets.APPLE_STORE_CONNECT_TEAM_ID }}"
echo "WORKFLOW_ID=$workflow_id" >> $GITHUB_ENV
- name: Run release_test-installation-${{ matrix.platform }}-${{ matrix.platform }}-${{ matrix.linkage }} which runs installation tests for different installation methods, platforms and linkage.
run: |
build_id="$(ruby ./scripts/xcode_cloud_helper.rb --build-workflow ${{ github.WORKFLOW_ID }} --token ${{ steps.token.outputs.token }})"
echo "BUILD_ID=$build_id" >> $GITHUB_ENV
- name: Wait for workflow to complete.
run: |
build_status=""
while [ "${build_status}" != "COMPLETE" || "${build_status}" != "FAILED" ]
do
build_status="$(ruby ./scripts/xcode_cloud_helper.rb --check-workflow-status ${{ github.BUILD_ID }} --token ${{ steps.token.outputs.token }})"
sleep 10
done
if [ "${build_status}" != "COMPLETE" ]; then
exit 0
done
post-release-channel:
runs-on: macos-latest
name: Publish to release Slack channel
needs: test-installation
steps:
- 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@fa20eb972b9f018654fdb4e2c7afb52b0532f907
with:
changelog: Realm/packages/ExtractedChangelog/ExtractedChangelog.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-release-channel
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 2e73578

Please sign in to comment.