diff --git a/.github/workflows/_publish-packages.yml b/.github/workflows/_publish-packages.yml index 52295db..0c4f432 100644 --- a/.github/workflows/_publish-packages.yml +++ b/.github/workflows/_publish-packages.yml @@ -50,9 +50,9 @@ jobs: git fetch origin "$BRANCH" git checkout "$BRANCH" - - uses: dart-lang/setup-dart@v1 + - uses: ./.github/actions/setup with: - sdk: ${{ vars.DART_VERSION }} + dart-version: ${{ vars.DART_VERSION }} - name: Verify prerequisite packages on pub.dev if: inputs.tier > 1 diff --git a/.github/workflows/finalize-release.yml b/.github/workflows/finalize-release.yml new file mode 100644 index 0000000..5b73178 --- /dev/null +++ b/.github/workflows/finalize-release.yml @@ -0,0 +1,59 @@ +name: Finalize Release + +on: + workflow_run: + workflows: ["Publish Tier 3"] + types: [completed] + +permissions: + contents: write + +jobs: + finalize: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get version from triggering tag + id: version + run: | + git fetch --tags + TAG=$(git tag --points-at ${{ github.event.workflow_run.head_sha }} | grep '^Release/' | head -1) + if [ -z "$TAG" ]; then + echo "::error::No Release tag found at commit ${{ github.event.workflow_run.head_sha }}" + exit 1 + fi + VERSION="${TAG#Release/}" + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Found tag: $TAG, version: $VERSION" + + - name: Checkout release branch + run: | + BRANCH="release/${{ steps.version.outputs.VERSION }}" + git fetch origin "$BRANCH" + git checkout "$BRANCH" + + - name: Setup Dart + uses: ./.github/actions/setup + with: + dart-version: ${{ vars.DART_VERSION }} + + - name: Switch dependencies to local + run: dart run tools/switch_deps.dart local + + - name: Commit local dependencies to release branch + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "chore: switch to local dependencies after publish" + git push origin release/${{ steps.version.outputs.VERSION }} + fi diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 15b8d08..81f6177 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -10,11 +10,8 @@ permissions: pull-requests: write jobs: - validate-and-prepare: + prepare: runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.VERSION }} - branch: ${{ steps.branch.outputs.NAME }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -22,49 +19,36 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate branch is main - id: branch + - name: Validate tag is on main run: | git fetch origin main if ! git merge-base --is-ancestor ${{ github.sha }} origin/main; then echo "::error::Release tag must be created from main branch!" exit 1 fi - BRANCH=$(git branch -r --contains ${{ github.sha }} | grep -E 'origin/(main|master)' | head -1 | sed 's/.*origin\///') - if [ -z "$BRANCH" ]; then - echo "::error::Tag must be created from main branch" - exit 1 - fi - echo "NAME=$BRANCH" >> $GITHUB_OUTPUT - - name: Extract version + - name: Extract version from tag id: version run: echo "VERSION=${GITHUB_REF#refs/tags/Release/}" >> $GITHUB_OUTPUT - - name: Checkout main branch - run: git checkout main - - name: Setup Dart - uses: dart-lang/setup-dart@v1 + uses: ./.github/actions/setup with: - sdk: ${{ vars.DART_VERSION }} + dart-version: ${{ vars.DART_VERSION }} - - name: Create release branch + - name: Prepare for publishing (switch to pub.dev deps) + run: dart run tools/prepare_publish.dart ${{ steps.version.outputs.VERSION }} + + - name: Create release branch and commit run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git checkout -b release/${{ steps.version.outputs.VERSION }} - - - name: Set package versions - run: dart tools/prepare_publish.dart ${{ steps.version.outputs.VERSION }} - - - name: Commit and push - run: | git add -A - git commit -m "chore: prepare release ${{ steps.version.outputs.VERSION }}" + git commit -m "chore: prepare release ${{ steps.version.outputs.VERSION }} with pub.dev dependencies" git push origin release/${{ steps.version.outputs.VERSION }} - - name: Create PR + - name: Create PR to main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -72,11 +56,15 @@ jobs: --title "Release ${{ steps.version.outputs.VERSION }}" \ --body "## Release ${{ steps.version.outputs.VERSION }} - This PR contains version bumps. + This PR is auto-created from the release tag. + + **Do not merge yet!** Publishing happens in tier workflows (tier1 → tier2 → tier3). + + After tier3 completes, dependencies will be switched back to local and this PR will be updated. - ### Deployment Status - - [ ] Tier 1 (Core) - - [ ] Tier 2 (Reflux, Express, WS, SQLite, MCP) - - [ ] Tier 3 (React)" \ + ### Publishing Tiers + - Tier 1: dart_logging, dart_node_core (triggered by this workflow) + - Tier 2: reflux, dart_node_express, dart_node_ws, dart_node_better_sqlite3, dart_node_mcp (20 min wait) + - Tier 3: dart_node_react, dart_node_react_native (20 min wait)" \ --base main \ --head release/${{ steps.version.outputs.VERSION }} diff --git a/.github/workflows/publish-tier1.yml b/.github/workflows/publish-tier1.yml index a7f0678..faeb533 100644 --- a/.github/workflows/publish-tier1.yml +++ b/.github/workflows/publish-tier1.yml @@ -16,4 +16,5 @@ jobs: with: tier: 1 packages: "dart_logging dart_node_core" + environment: pub.dev-tier1 secrets: inherit diff --git a/packages/dart_node_core/pubspec.yaml b/packages/dart_node_core/pubspec.yaml index eb927f7..790a2ff 100644 --- a/packages/dart_node_core/pubspec.yaml +++ b/packages/dart_node_core/pubspec.yaml @@ -2,7 +2,6 @@ name: dart_node_core description: Core JS interop utilities for dart_node packages version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0 diff --git a/packages/dart_node_express/pubspec.yaml b/packages/dart_node_express/pubspec.yaml index 85fd250..fb8e247 100644 --- a/packages/dart_node_express/pubspec.yaml +++ b/packages/dart_node_express/pubspec.yaml @@ -2,7 +2,6 @@ name: dart_node_express description: Express.js bindings for Dart version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0 diff --git a/packages/dart_node_react/pubspec.yaml b/packages/dart_node_react/pubspec.yaml index 0098e9f..eb581dd 100644 --- a/packages/dart_node_react/pubspec.yaml +++ b/packages/dart_node_react/pubspec.yaml @@ -2,7 +2,6 @@ name: dart_node_react description: React bindings for Dart version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0 diff --git a/packages/dart_node_react_native/pubspec.yaml b/packages/dart_node_react_native/pubspec.yaml index c9c414a..90b2d05 100644 --- a/packages/dart_node_react_native/pubspec.yaml +++ b/packages/dart_node_react_native/pubspec.yaml @@ -2,7 +2,6 @@ name: dart_node_react_native description: React Native bindings for Dart version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0 diff --git a/packages/dart_node_ws/pubspec.yaml b/packages/dart_node_ws/pubspec.yaml index 73c86d3..374a47e 100644 --- a/packages/dart_node_ws/pubspec.yaml +++ b/packages/dart_node_ws/pubspec.yaml @@ -2,7 +2,6 @@ name: dart_node_ws description: WebSocket bindings for Dart on Node.js version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0 diff --git a/packages/reflux/pubspec.yaml b/packages/reflux/pubspec.yaml index 58e72a8..74619e1 100644 --- a/packages/reflux/pubspec.yaml +++ b/packages/reflux/pubspec.yaml @@ -2,7 +2,6 @@ name: reflux description: Predictable state container for Dart apps - inspired by Redux patterns version: 0.9.0-beta repository: https://github.com/MelbourneDeveloper/dart_node -publish_to: none environment: sdk: ^3.10.0