Skip to content

Commit 28a60f9

Browse files
committed
ci: Update release please config
1 parent b279caa commit 28a60f9

File tree

6 files changed

+78
-10
lines changed

6 files changed

+78
-10
lines changed

.github/workflows/on-release.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
echo "package=all" >> $GITHUB_ENV
3333
for package in all zeta_flutter_theme zeta_flutter_utils zeta_icons zeta_flutter; do
34-
if [[ "${{GITHUB_REF}}" == *"${package}"* ]]; then
34+
if [[ "${{github.ref}}" == *"${package}"* ]]; then
3535
echo Package is $package
3636
echo "package=${package}" >> $GITHUB_ENV
3737
break
@@ -49,20 +49,30 @@ jobs:
4949
run: flutter pub get
5050
- name: Install melos
5151
run: dart pub global activate melos
52-
- name: Check Publish Warnings
53-
run: melos publish --dry-run
52+
# - name: Check Publish Warnings
53+
# run: melos publish --dry-run
5454

5555
- name: Publish all
56-
if: ${{ env.package == 'all' }}
56+
if: always() && env.package == 'all'
5757
run: melos publish --no-dry-run
5858

59-
- name: Publish individual package
60-
if: ${{ env.package != 'all' }}
59+
- name: Publish individual package (dry-run)
60+
if: always() && env.package != 'all'
6161
run: |
62+
bash scripts/update_individual.sh ${{ env.package }}
6263
cd packages/${{ env.package }}
63-
dart format . --fix
64+
dart format .
6465
dart fix --apply
6566
flutter pub publish --dry-run
67+
cd ../..
68+
69+
- name: Publish individual package
70+
if: always() && env.package != 'all'
71+
run: |
72+
bash scripts/update_individual.sh ${{ env.package }}
73+
cd packages/${{ env.package }}
74+
dart format .
75+
dart fix --apply
6676
flutter pub publish --no-dry-run
6777
6878
deploy-website:

.github/workflows/pull-request.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ jobs:
2121
cache: true
2222
channel: stable
2323
flutter-version: 3.29.x
24+
2425
- run: dart pub global activate melos
26+
27+
- name: Release please help
28+
if: startsWith(github.head_ref, 'release-please') && !endsWith(github.head_ref, 'zeta_flutter')
29+
run: |
30+
PACKAGE_NAME=$(echo ${{github.head_ref}} | awk -F '--' '{print $NF}')
31+
sh scripts/update_individual.sh $PACKAGE_NAME
32+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
33+
git config --global user.name "github-actions[bot]"
34+
git add .
35+
git commit -m "deps: update dependencies in $PACKAGE_NAME"
36+
git push origin ${{github.head_ref}} -f
37+
2538
- run: dart run build_runner build --delete-conflicting-outputs
2639
- run: |
2740
cd widgetbook

packages/zeta_flutter_theme/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ dev_dependencies:
2222
sdk: flutter
2323
mockito: ^5.4.5
2424
zds_analysis: ^1.1.1
25-
zeta_flutter: ^0.20.2
25+
zeta_flutter:
26+
path: ../zeta_flutter
2627

2728
flutter:
2829
fonts:

packages/zeta_flutter_utils/pubspec.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,3 @@ dev_dependencies:
2424
zds_analysis: ^1.1.1
2525
zeta_flutter:
2626
path: ../zeta_flutter
27-
zeta_flutter_theme:
28-
path: ../zeta_flutter_theme

release-please-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
}
1919
},
2020
"pull-request-title-pattern": "chore(${component}): release ${version}",
21+
"include-component-in-tag": true,
22+
"include-v-in-tag": true,
23+
"tag-separator": "@",
2124
"extra-files": [
2225
"example/lib/home.dart",
2326
"widgetbook/lib/introduction.dart"

scripts/update_individual.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# save first input arg as package
4+
package=$1
5+
6+
7+
# check that package is not 'zeta_flutter'
8+
if [ "$package" = "zeta_flutter" ]; then
9+
echo "Cannot update zeta_flutter package using this script"
10+
exit 1
11+
fi
12+
13+
# Get the version from packages/$package/pubspec.yaml
14+
package_pubspec="packages/$package/pubspec.yaml"
15+
if [ ! -f "$package_pubspec" ]; then
16+
echo "Package pubspec file not found at $package_pubspec"
17+
exit 1
18+
fi
19+
20+
# Extract the version from the pubspec.yaml file
21+
version=$(grep "^version:" "$package_pubspec" | sed 's/version: //' | tr -d '[:space:]')
22+
if [ -z "$version" ]; then
23+
echo "Could not find version in $package_pubspec"
24+
exit 1
25+
fi
26+
27+
echo "Found version $version for package $package"
28+
29+
30+
# load packages/zeta_flutter/pubspec.yaml file
31+
file_path="packages/zeta_flutter/pubspec.yaml"
32+
33+
# update the line that starts with $package, change the version to $version
34+
if [[ "$OSTYPE" == "darwin"* ]]; then
35+
# macOS uses BSD sed which requires a different syntax
36+
sed -i '' "s/\($package: \).*$/\1^$version/g" "$file_path"
37+
else
38+
# Linux uses GNU sed
39+
sed -i "s/\($package: \).*$/\1^$version/g" "$file_path"
40+
fi
41+
42+
43+
echo "Updated $package to version ^$version in pubspec.yaml"

0 commit comments

Comments
 (0)