-
Notifications
You must be signed in to change notification settings - Fork 87
107 lines (93 loc) · 4.4 KB
/
prepare-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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 Runner
uses: ./.github/actions/setup-runner
- name: Update pubspec.yaml files
run: REALM_VERSION=${{ steps.update-changelog.outputs.new-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_library.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/handles/native/realm_library.dart'
- name: Make sure we updated libraryVersion in realm_library.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