Prepare Release #131
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
name: Prepare Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Use this to provide a version, instead of deriving it from the changelog. | |
required: false | |
type: string | |
env: | |
REALM_CI: true | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Update Changelog | |
id: update-changelog | |
uses: realm/ci-actions/update-changelog@338bf3e7575015a28faec8b67614385d122aece7 | |
with: | |
changelog: ${{ github.workspace }}/CHANGELOG.md | |
version: ${{ inputs.version }} | |
version-suffix: '' | |
- name : Setup Dart SDK | |
uses: dart-lang/setup-dart@main | |
with: | |
sdk: stable | |
architecture: 'x64' | |
- name: Setup Melos | |
run: dart pub global activate melos | |
- name: Update pubspec.yaml files | |
run: REALM_VERSION=${{ inputs.version}} melos run update:version:realm | |
- name: Update realm.podspec | |
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0 | |
with: | |
find: " s.version(\\s+)= '[^']*'" | |
replace: " s.version$1= '${{ steps.update-changelog.outputs.new-version }}'" | |
include: '**realm.podspec' | |
- name: Update libraryVersion in realm_core.dart | |
id: update-libraryVersion | |
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0 | |
with: | |
find: "const libraryVersion = '[^']*';" | |
replace: "const libraryVersion = '${{ steps.update-changelog.outputs.new-version }}';" | |
include: 'packages/realm_dart/lib/src/native/realm_core.dart' | |
- name: Make sure we updated libraryVersion in realm_core.dart | |
run: | | |
if [ '${{ steps.update-libraryVersion.outputs.modifiedFiles }}' != '1' ]; then | |
echo 'Expected exactly one modified file, got ${{ steps.update-libraryVersion.outputs.modifiedFiles }}' | |
exit 1 | |
fi | |
- name: Update realm_dart_library_version in realm_dart.cpp | |
id: update-realm_dart_library_version | |
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0 | |
with: | |
find: 'RLM_API const char\* realm_dart_library_version\(\) \{ return "[^"]*"; \}' | |
replace: 'RLM_API const char* realm_dart_library_version() { return "${{ steps.update-changelog.outputs.new-version }}"; }' | |
include: 'packages/realm_dart/src/realm_dart.cpp' | |
- name: Make sure we updated realm_dart_library_version in realm_dart.cpp | |
run: | | |
if [ '${{ steps.update-realm_dart_library_version.outputs.modifiedFiles }}' != '1' ]; then | |
echo 'Expected exactly one modified file, got ${{ steps.update-realm_dart_library_version.outputs.modifiedFiles }}' | |
exit 1 | |
fi | |
- name: Read Core version | |
id: get-core-version | |
run: | | |
pkgVersion=$(yq '.VERSION' dependencies.yml) | |
echo "core-version=$pkgVersion" >> $GITHUB_OUTPUT | |
echo "Realm Core version: $pkgVersion" | |
shell: bash | |
working-directory: packages/realm_dart/src/realm-core | |
- name: Update realmCoreVersion in metrics_command.dart | |
id: update-realmCoreVersion | |
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0 | |
with: | |
find: "const realmCoreVersion = '[^']*';" | |
replace: "const realmCoreVersion = '${{ steps.get-core-version.outputs.core-version }}';" | |
include: 'packages/realm_dart/lib/src/cli/metrics/metrics_command.dart' | |
- name: Make sure we updated realmCoreVersion in metrics | |
run: | | |
if [ ${{ steps.update-realmCoreVersion.outputs.modifiedFiles }} -gt 1 ]; then | |
echo 'At most one modified file expected, got ${{ steps.update-realmCoreVersion.outputs.modifiedFiles }}' | |
exit 1 | |
fi | |
- name: Create Release PR | |
uses: peter-evans/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad #! 3.10.1 | |
with: | |
branch: release/${{ steps.update-changelog.outputs.new-version }} | |
base: ${{ github.ref_name }} | |
title: '[Release ${{ steps.update-changelog.outputs.new-version }}]' | |
draft: false | |
body: An automated PR for next release. | |
commit-message: '[Release ${{ steps.update-changelog.outputs.new-version }}]' | |
token: ${{ secrets.REALM_CI_PAT }} | |
labels: no-jira-ticket |