|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ['main'] |
| 6 | + |
| 7 | +env: |
| 8 | + FORCE_COLOR: 1 |
| 9 | + |
| 10 | +jobs: |
| 11 | + create-release-pr: |
| 12 | + name: Create Release PR |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + permissions: |
| 15 | + contents: write |
| 16 | + pull-requests: write |
| 17 | + timeout-minutes: 5 |
| 18 | + concurrency: ${{ github.workflow }}-create-release-pr |
| 19 | + outputs: |
| 20 | + published: ${{ steps.create-release-pr.outputs.published }} |
| 21 | + steps: |
| 22 | + - name: Checkout Repo |
| 23 | + uses: actions/checkout@v4 |
| 24 | + - uses: ./.github/actions/setup |
| 25 | + - name: Create Release PR |
| 26 | + id: create-release-pr |
| 27 | + uses: changesets/action@v1 |
| 28 | + with: |
| 29 | + publish: pnpm changeset publish |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + - name: Save Published Packages |
| 33 | + if: steps.create-release-pr.outputs.published == 'true' |
| 34 | + run: | |
| 35 | + echo '${{steps.create-release-pr.outputs.publishedPackages}}' \ |
| 36 | + > ${{ github.workspace }}/published-packages.json |
| 37 | + - name: Upload Published Packages |
| 38 | + if: steps.create-release-pr.outputs.published == 'true' |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: published-packages |
| 42 | + path: ${{ github.workspace }}/published-packages.json |
| 43 | + |
| 44 | + deploy-production: |
| 45 | + name: Deploy (production) |
| 46 | + needs: create-release-pr |
| 47 | + if: needs.create-release-pr.outputs.published == 'true' |
| 48 | + runs-on: ubuntu-24.04 |
| 49 | + timeout-minutes: 10 |
| 50 | + concurrency: ${{ github.workflow }}-deploy-production |
| 51 | + permissions: |
| 52 | + contents: read |
| 53 | + steps: |
| 54 | + - name: Checkout Repo |
| 55 | + uses: actions/checkout@v4 |
| 56 | + - name: Download published packages |
| 57 | + uses: actions/download-artifact@v4 |
| 58 | + with: |
| 59 | + name: published-packages |
| 60 | + path: ${{ runner.temp }} |
| 61 | + - uses: ./.github/actions/setup |
| 62 | + - name: Deploy Published Workers (production) |
| 63 | + run: pnpm runx deploy-published-workers --env production |
| 64 | + env: |
| 65 | + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
| 66 | + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
0 commit comments