|
| 1 | +name: Release v3 version |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + validate-branch: |
| 8 | + name: Validate Branch |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Ensure running on vibe3 |
| 12 | + if: github.ref != 'refs/heads/vibe3' |
| 13 | + run: | |
| 14 | + echo "::error::Release v3 workflow must be triggered from the vibe3 branch. Current branch: ${{ github.ref }}" |
| 15 | + exit 1 |
| 16 | +
|
| 17 | + notify-release-start: |
| 18 | + name: Notify Slack - Release Started |
| 19 | + needs: validate-branch |
| 20 | + runs-on: ubuntu-latest |
| 21 | + continue-on-error: true |
| 22 | + steps: |
| 23 | + - name: Send Slack notification |
| 24 | + uses: fjogeleit/http-request-action@v1 |
| 25 | + with: |
| 26 | + url: ${{ secrets.SLACK_DEV_TEAM_WEBHOOK_URL }} |
| 27 | + method: "POST" |
| 28 | + contentType: "application/json" |
| 29 | + data: | |
| 30 | + { |
| 31 | + "event": "v3_release_started", |
| 32 | + "actor": "${{ github.actor }}", |
| 33 | + "commit_id": "${{ github.sha }}", |
| 34 | + "workflow": "${{ github.workflow }}", |
| 35 | + "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 36 | + "commit_url": "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" |
| 37 | + } |
| 38 | +
|
| 39 | + build: |
| 40 | + name: Build |
| 41 | + needs: validate-branch |
| 42 | + uses: ./.github/workflows/build-and-upload.yml |
| 43 | + secrets: |
| 44 | + npm_token: ${{ secrets.npm_token }} |
| 45 | + |
| 46 | + test: |
| 47 | + name: Test |
| 48 | + needs: build |
| 49 | + uses: ./.github/workflows/test.yml |
| 50 | + with: |
| 51 | + has_changes: ${{ needs.build.outputs.has_changes }} |
| 52 | + secrets: |
| 53 | + npm_token: ${{ secrets.npm_token }} |
| 54 | + |
| 55 | + release: |
| 56 | + name: Release |
| 57 | + needs: [build, test] |
| 58 | + if: ${{ needs.build.outputs.has_changes == 'true' }} |
| 59 | + runs-on: ubuntu-latest |
| 60 | + env: |
| 61 | + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + token: ${{ secrets.VIBE_GITHUB_TOKEN }} |
| 66 | + fetch-depth: 0 |
| 67 | + - name: Run Setup |
| 68 | + uses: ./.github/actions/setup |
| 69 | + with: |
| 70 | + npm_token: ${{ secrets.npm_token }} |
| 71 | + - uses: ./.github/actions/git-creds |
| 72 | + - uses: ./.github/actions/download-builds |
| 73 | + - name: Generate new versions |
| 74 | + run: yarn lerna version --exact --conventional-commits --message "Publish [skip ci]" -y --create-release github |
| 75 | + env: |
| 76 | + GH_TOKEN: ${{ secrets.VIBE_GITHUB_TOKEN }} |
| 77 | + - run: yarn config set registry https://registry.npmjs.org/ |
| 78 | + - name: Setup .npmrc for publish |
| 79 | + id: setup-npmrc |
| 80 | + run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc |
| 81 | + - name: Publish to npm with v3 dist-tag |
| 82 | + run: yarn lerna publish from-package --dist-tag v3 --dry-run -y |
| 83 | + - name: Remove .npmrc |
| 84 | + if: steps.setup-npmrc.outcome == 'success' |
| 85 | + run: rm .npmrc |
0 commit comments