name: Publish env: NODE_VERSION: 24 VP_GIT_HOOKS: 0 # this branch only releases from main # other versions are released from their respective release/* branches on: push: branches: - main permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true jobs: resolve-config: name: Resolve publish config runs-on: ubuntu-latest timeout-minutes: 5 outputs: configured: ${{ steps.resolve.outputs.configured }} dist_tag: ${{ steps.resolve.outputs.dist_tag }} label: ${{ steps.resolve.outputs.label }} title: ${{ steps.resolve.outputs.title }} commit: ${{ steps.resolve.outputs.commit }} steps: - name: Checkout repo uses: actions/checkout@v7 - name: Validate publish config run: node --test .github/scripts/__tests__/*.test.mjs - name: Look up branch in publish config id: resolve run: node .github/scripts/resolve-publish-config.mjs "${{ github.ref_name }}" >> "$GITHUB_OUTPUT" build: name: Build runs-on: ubuntu-latest timeout-minutes: 30 needs: resolve-config if: needs.resolve-config.outputs.configured == 'true' steps: - uses: actions/checkout@v7 - uses: ./.github/actions/setup-env with: node-version: ${{ env.NODE_VERSION }} cache: 'true' - name: Install dependencies run: vp install --frozen-lockfile -- --strict-peer-dependencies - name: Run build run: vp run build && vp run build:demos - name: Check package exports run: vp run check:package-exports - name: Archive package dist artifacts run: tar -cf package-dist-artifacts.tar packages/*/dist - name: Upload package dist artifacts uses: actions/upload-artifact@v7 with: name: package-dist-artifacts if-no-files-found: error path: package-dist-artifacts.tar release: name: Bump Versions OR Release to Registry runs-on: ubuntu-latest timeout-minutes: 30 needs: [resolve-config, build] permissions: id-token: write contents: write pull-requests: write outputs: dist_tag: ${{ needs.resolve-config.outputs.dist_tag }} label: ${{ needs.resolve-config.outputs.label }} published: ${{ steps.changesets.outputs.published }} steps: - uses: actions/checkout@v7 - uses: ./.github/actions/setup-env with: node-version: ${{ env.NODE_VERSION }} cache: 'true' - name: Update npm for trusted publishing run: npm install -g npm@11.6.2 - name: Install dependencies run: vp install --frozen-lockfile -- --strict-peer-dependencies - name: Download package dist artifacts uses: actions/download-artifact@v8 with: name: package-dist-artifacts path: . - name: Restore package dist artifacts run: tar -xf package-dist-artifacts.tar - name: Verify package dist artifacts run: bash ./scripts/check-package-dists.sh && vp run check:package-exports - name: Run changesets release flow id: changesets uses: changesets/action@v1 with: createGithubReleases: false version: vp run version publish: vp exec changeset publish title: ${{ needs.resolve-config.outputs.title }} commit: ${{ needs.resolve-config.outputs.commit }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_CONFIG_PROVENANCE: true NPM_CONFIG_ACCESS: public notify-slack: name: Send notification to Slack runs-on: ubuntu-latest needs: release if: needs.release.outputs.published == 'true' timeout-minutes: 5 permissions: {} steps: - name: Send Slack notification uses: slackapi/slack-github-action@v4.0.0 with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} webhook-type: webhook-trigger payload: | { "message": "[Tiptap Editor ${{ needs.release.outputs.label }}]: Published packages from branch ${{ github.ref_name }} with npm tag ${{ needs.release.outputs.dist_tag }}." } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} notify-slack-failure: name: Send failure notification to Slack runs-on: ubuntu-latest needs: [resolve-config, release] if: always() && (needs.resolve-config.result == 'failure' || needs.release.result == 'failure') timeout-minutes: 5 permissions: {} steps: - name: Send Slack failure notification uses: slackapi/slack-github-action@v4.0.0 with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} webhook-type: webhook-trigger payload: | { "message": "[Tiptap Editor Release]: There was an issue publishing packages from branch ${{ github.ref_name }}. Logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}