Skip to content

Commit

Permalink
test logic for tag push within dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Feb 4, 2025
1 parent 15e689e commit 109e9f2
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 50 deletions.
110 changes: 62 additions & 48 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,73 @@ jobs:
runs-on: ubuntu-latest
permissions:
id-token: write
environment: pub.dev
# environment: pub.dev
steps:
- name: Set package to publish (workflow dispatch)
if: github.event_name == 'workflow_dispatch'
run: echo package=${{ github.event.inputs.package }} >> $GITHUB_ENV
- name: Set package to publish (tag push)
if: github.event_name == 'push'
# - name: Set package to publish (workflow dispatch)
# if: github.event_name == 'workflow_dispatch'
# run: echo package=${{ github.event.inputs.package }} >> $GITHUB_ENV
# - name: Set package to publish (tag push)
# if: github.event_name == 'push'
# run: |
# p=zeta_flutter
# for package in all zeta_flutter zeta_flutter_theme zeta_flutter_utils zeta_icons; do
# if [[ "${GITHUB_REF}" == *"${package}"* ]]; then
# p=$package
# break
# fi
# echo "package=${p}" >> $GITHUB_ENV
# done
- name: Set package to publish (dispatch test)
# if: github.event_name == 'push'
run: |
p=zeta_flutter
for package in zeta_flutter zeta_flutter_components zeta_flutter_theme zeta_flutter_utils zeta_icons; do
if [[ "${GITHUB_REF}" == *"${package}"* ]]; then
p=$package
echo "package=all" >> $GITHUB_ENV
for package in all zeta_flutter zeta_flutter_theme zeta_flutter_utils zeta_icons; do
if [[ "${{github.event.inputs.package}}" == *"${package}"* ]]; then
echo Package is $package
echo "package=${package}" >> $GITHUB_ENV
break
fi
echo "package=${p}" >> $GITHUB_ENV
done
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version: 3.27.x
- name: Install dependencies
run: flutter pub get
- name: Install melos
run: dart pub global activate melos
- name: Check Publish Warnings
run: melos publish --dry-run
- name: test
run: echo ${{env.package}}
# - uses: actions/checkout@v4
# - uses: dart-lang/setup-dart@v1
# - name: Install Flutter
# uses: subosito/flutter-action@v2
# with:
# cache: true
# channel: stable
# flutter-version: 3.27.x
# - name: Install dependencies
# run: flutter pub get
# - name: Install melos
# run: dart pub global activate melos
# - name: Check Publish Warnings
# run: melos publish --dry-run

- name: Publish all
if: ${{ env.package == 'all' }}
run: melos publish # --no-dry-run TODO: Uncomment this line to publish
# - name: Publish all
# if: ${{ env.package == 'all' }}
# run: melos publish --no-dry-run

- name: Publish individual package
if: ${{ env.package != 'all' }}
run: |
cd packages/${{ env.package }}
flutter pub publish --dry-run
flutter pub publish # --no-dry-run TODO: Uncomment this line to publish
# - name: Publish individual package
# if: ${{ env.package != 'all' }}
# run: |
# cd packages/${{ env.package }}
# flutter pub publish --dry-run
# flutter pub publish --no-dry-run

deploy-website:
runs-on: ubuntu-latest
needs: check-package
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'zebratechnologies',
repo: 'zeta',
workflow_id: 'deploy.yml',
ref: 'main',
})
# deploy-website:
# runs-on: ubuntu-latest
# needs: check-package
# steps:
# - uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'zebratechnologies',
# repo: 'zeta',
# workflow_id: 'deploy.yml',
# ref: 'main',
# })
4 changes: 2 additions & 2 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": {
"packages/zeta_flutter": {
"release-type": "dart",
"package-name": "zeta_flutter_components"
"package-name": "zeta_flutter"
},
"packages/zeta_flutter_theme": {
"release-type": "dart",
Expand All @@ -18,7 +18,7 @@
},
".": {
"release-type": "dart",
"package-name": "zeta_flutter"
"package-name": "all"
}
},
"pull-request-title-pattern": "chore(${component}): release ${version}",
Expand Down

0 comments on commit 109e9f2

Please sign in to comment.