Skip to content

Commit

Permalink
Simplify CI a bit with melos
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Feb 6, 2024
1 parent 347e194 commit 0c4053c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 57 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dart-desktop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jobs:
sdk: stable
architecture: ${{ inputs.architecture == 'arm' && 'arm64' || 'x64'}}

- name: Install dependencies
run: dart pub get
- name: Setup Melos
run: |
dart pub get
dart run melos bootstrap
- name: Bump ulimit
run: ulimit -n 10240
Expand Down
71 changes: 16 additions & 55 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,52 +55,18 @@ jobs:
done
working-directory: packages/realm_dart

- name: Update realm_* path dependencies (Production)
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
if: ${{ github.event.inputs.environment == 'Production' }}
with:
find: " realm_(common|generator|dart):(\\n|\\r\\n) path:.*"
replace: " realm_$1: ${{ steps.get-version.outputs.version }}"
include: "**pubspec.yaml"

- name: Update realm_* path dependencies (Staging)
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
if: ${{ github.event.inputs.environment != 'Production' }}
with:
find: " realm_(common|generator|dart):(\\n|\\r\\n) path:.*"
replace: " realm_$1:\n path: ../realm_$1"
include: "**pubspec.yaml"

- name: Update pubspec.yaml version (Staging)
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
- name: Update pubspec.yaml versions (Staging)
if: ${{ github.event.inputs.environment != 'Production' }}
with:
find: 'version: .*'
replace: 'version: ${{ steps.get-version.outputs.version }}'
include: '**pubspec.yaml'

- name: Remove pubspec.yaml/publish_to:none
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
with:
find: "publish_to: none(\\n|\\r\\n)"
replace: " "
include: "**pubspec.yaml"

- name: Package realm_common
run: |
cp -Lr ../package/realm_common .
cd realm_common
dart pub publish --dry-run || true
working-directory: release

- name: Package realm_generator
run: |
cp -Lr ../packages/realm_generator .
cd realm_generator
dart pub publish --dry-run || true
working-directory: release
# This can be done smarter, if we let melos control the versioning more
run: >-
dart run melos version
-V realm:${{ steps.get-version.outputs.version }}
-V realm_common:${{ steps.get-version.outputs.version }}
-V realm_dart:${{ steps.get-version.outputs.version }}
-V realm_generator:${{ steps.get-version.outputs.version }}
# realm_flutter has symlinks to native binaries which should not be packaged
# TODO: This will be removed once we migrate to native-assets
- name: Cleanup binary symlinks
run: |
rm -rf packages/realm/android/src/main/cpp/lib
Expand All @@ -110,21 +76,16 @@ jobs:
rm packages/realm/windows/binary
rm packages/realm/example/binary
- name: Package realm (flutter)
- name: Copy packages to release
run: |
cp -Lr ../packages/realm realm
cd realm
flutter pub publish --dry-run || true
cp -Lr ../package/realm_common .
cp -Lr ../packages/realm_generator .
cp -Lr ../packages/realm .
cp -Lr ../packages/realm_dart .
working-directory: release

- name: Package realm_dart
run: |
mkdir realm_dart
cp -Lr ../package/realm_dart/bin ../package/realm_dart/example ../package/realm_dart/lib ../package/realm_dart/test realm_dart
rsync -vt ../* realm_dart/
cd realm_dart
dart pub publish --dry-run || true
working-directory: release
- name: Publish dry-run
run: dart run melos publish --dry-run || true # there are warnings that we don't want to fail the build for

- name: Extract Changelog
run: |
Expand Down

0 comments on commit 0c4053c

Please sign in to comment.