Publish Tier 2 #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Tier 2 (Express, WS, SQLite, MCP) | |
| on: | |
| schedule: | |
| # Runs 20 minutes after tier 1 would typically complete | |
| # Adjust cron as needed - this runs at :20 past each hour | |
| - cron: '20 * * * *' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., 0.2.0-beta)' | |
| required: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| check-and-publish: | |
| runs-on: ubuntu-latest | |
| environment: pub.dev | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Get latest release version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| # Get the latest Release tag | |
| LATEST_TAG=$(git tag -l 'Release/*' --sort=-v:refname | head -n1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No Release tags found, skipping" | |
| echo "SKIP=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| VERSION="${LATEST_TAG#Release/}" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Check if tier 1 packages are available | |
| if: steps.version.outputs.SKIP != 'true' | |
| id: check | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| # Check dart_node_core is published | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://pub.dev/api/packages/dart_node_core/versions/$VERSION") | |
| if [ "$HTTP_CODE" != "200" ]; then | |
| echo "dart_node_core $VERSION not yet available, skipping this run" | |
| echo "SKIP=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "Tier 1 packages available, proceeding with tier 2" | |
| echo "SKIP=false" >> $GITHUB_OUTPUT | |
| - name: Check if tier 2 already published | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' | |
| id: already | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| # If express is already published, skip | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://pub.dev/api/packages/dart_node_express/versions/$VERSION") | |
| if [ "$HTTP_CODE" = "200" ]; then | |
| echo "dart_node_express $VERSION already published, skipping" | |
| echo "SKIP=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "SKIP=false" >> $GITHUB_OUTPUT | |
| - name: Prepare packages for publishing | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' && steps.already.outputs.SKIP != 'true' | |
| run: dart tools/prepare_publish.dart ${{ steps.version.outputs.VERSION }} | |
| - name: Publish dart_node_express | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' && steps.already.outputs.SKIP != 'true' | |
| run: | | |
| cd packages/dart_node_express | |
| dart pub get | |
| dart pub publish --force | |
| - name: Publish dart_node_ws | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' && steps.already.outputs.SKIP != 'true' | |
| run: | | |
| cd packages/dart_node_ws | |
| dart pub get | |
| dart pub publish --force | |
| - name: Publish dart_node_better_sqlite3 | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' && steps.already.outputs.SKIP != 'true' | |
| run: | | |
| cd packages/dart_node_better_sqlite3 | |
| dart pub get | |
| dart pub publish --force | |
| - name: Publish dart_node_mcp | |
| if: steps.version.outputs.SKIP != 'true' && steps.check.outputs.SKIP != 'true' && steps.already.outputs.SKIP != 'true' | |
| run: | | |
| cd packages/dart_node_mcp | |
| dart pub get | |
| dart pub publish --force |