Skip to content

Prepare Release

Prepare Release #117

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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
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: Update pubspec.yaml
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
with:
find: 'version: .*'
replace: 'version: ${{ steps.update-changelog.outputs.new-version }}'
include: '**pubspec.yaml'
- 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: '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: '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: |
cd src/realm-core
pkgVersion=$(grep "\bVERSION=" dependencies.list | cut -d= -f2)
echo "core-version=$pkgVersion" >> $GITHUB_OUTPUT
echo "Realm Core version: $pkgVersion"
shell: bash
- 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: 'lib/src/cli/metrics/metrics_command.dart'
- name: Make sure we updated realmCoreVersion in metrics
run: |
if [ '${{ steps.update-realmCoreVersion.outputs.modifiedFiles }}' -le 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: main
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 }}