Skip to content

Commit

Permalink
👷 use yq to manipulate pubspec.yaml in publish CI (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse authored Aug 7, 2023
1 parent 8dbde76 commit 2e00b6a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ jobs:
run: |
set -e
mkdir -p $XDG_CONFIG_HOME/dart
echo '${{ secrets.CREDENTIAL_JSON }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"
echo -n '${{ secrets.CREDENTIAL_JSON }}' > $XDG_CONFIG_HOME/dart/pub-credentials.json
- name: Publish
id: publish
if: ${{ env.IS_VERSION_GREATER == 1 }}
run: bash tool/publish.sh ${{ matrix.package }}
run: |
set -e
pushd ${{ matrix.package }} || exit
yq -i 'del(.dependency_overrides)' pubspec.yaml
dart pub publish --force
popd || exit
- name: Skip publish
id: skip_publish
if: ${{ env.IS_VERSION_GREATER == 0 }}
Expand All @@ -87,4 +92,4 @@ jobs:
id: cleanup
if: ${{ always() }}
run: |
rm -rf "$XDG_CONFIG_HOME/dart/pub-credentials.json"
rm -rf $XDG_CONFIG_HOME/dart/pub-credentials.json
9 changes: 7 additions & 2 deletions .github/workflows/publish_dry_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ jobs:
- name: Publish (dry run)
id: publish_dry_run
if: ${{ env.IS_VERSION_GREATER == 1 }}
run: bash tool/publish.sh ${{ matrix.package }} --dry-run
run: |
set -e
pushd ${{ matrix.package }} || exit
yq -i 'del(.dependency_overrides)' pubspec.yaml
dart pub publish --dry-run
popd || exit
- name: Skip publish (dry run)
id: skip_publish_dry_run
if: ${{ env.IS_VERSION_GREATER == 0 }}
run: echo "Skipping publish (dry run) for ${{ matrix.package }} because the version is not greater than the one on pub.dev"
run: echo "Skipping publish (dry run) for ${{ matrix.package }} because the version is not greater than the one on pub.dev"
3 changes: 3 additions & 0 deletions chopper/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ dev_dependencies:
lints: ^2.1.1
test: ^1.24.4
transparent_image: ^2.0.1
chopper_generator: ^7.0.0

dependency_overrides:
chopper_generator:
path: ../chopper_generator
1 change: 0 additions & 1 deletion chopper_built_value/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ dev_dependencies:
lints: ^2.1.1

dependency_overrides:
# Comment before publish
chopper:
path: ../chopper
1 change: 0 additions & 1 deletion chopper_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ dev_dependencies:
test: ^1.24.4

dependency_overrides:
# Comment before publish
chopper:
path: ../chopper
19 changes: 0 additions & 19 deletions tool/publish.sh

This file was deleted.

0 comments on commit 2e00b6a

Please sign in to comment.