|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + type: choice |
| 7 | + description: 'Release Version (next, beta, alpha, latest)' |
| 8 | + required: true |
| 9 | + default: 'next' |
| 10 | + options: |
| 11 | + - next |
| 12 | + - beta |
| 13 | + - alpha |
| 14 | + - latest |
| 15 | + branch: |
| 16 | + description: 'Release Branch (confirm release branch)' |
| 17 | + required: true |
| 18 | + default: 'canary' |
| 19 | + issue_comment: |
| 20 | + types: [created] |
| 21 | + |
| 22 | +permissions: |
| 23 | + id-token: write |
| 24 | + |
| 25 | +jobs: |
| 26 | + issue_comment: |
| 27 | + name: Release with comment |
| 28 | + if: github.event.issue.pull_request && contains(github.event.comment.body, '!canary') |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout Repo |
| 33 | + uses: actions/checkout@v3 |
| 34 | + with: |
| 35 | + fetch-depth: 1 |
| 36 | + ref: refs/pull/${{ github.event.issue.number }}/head |
| 37 | + |
| 38 | + - name: Install Pnpm |
| 39 | + run: corepack enable |
| 40 | + |
| 41 | + - name: Setup Node.js 18 |
| 42 | + uses: actions/setup-node@v3 |
| 43 | + with: |
| 44 | + node-version: '18' |
| 45 | + cache: 'pnpm' |
| 46 | + |
| 47 | + - name: Install deps |
| 48 | + run: pnpm install |
| 49 | + |
| 50 | + - name: Build and test Packages |
| 51 | + run: npx nx affected -t pre-release --parallel=3 --exclude='*,!tag:package' --base=origin/canary --head=${{ github.ref }} |
| 52 | + |
| 53 | + - name: Release |
| 54 | + uses: web-infra-dev/actions@v2 |
| 55 | + with: |
| 56 | + version: 'next' |
| 57 | + type: 'release' |
| 58 | + branch: '' |
| 59 | + tools: 'changeset' |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} |
| 62 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 63 | + REPOSITORY: ${{ github.repository }} |
| 64 | + PULL_REQUEST_NUMBER: ${{ github.event.issue.number }} |
| 65 | + COMMENT: ${{ toJson(github.event.comment) }} |
| 66 | + |
| 67 | + release: |
| 68 | + name: Release |
| 69 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' }} |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@v3 |
| 74 | + with: |
| 75 | + fetch-depth: 25 |
| 76 | + |
| 77 | + - name: Install Pnpm |
| 78 | + run: corepack enable |
| 79 | + |
| 80 | + - name: Setup Node.js 18 |
| 81 | + uses: actions/setup-node@v3 |
| 82 | + with: |
| 83 | + node-version: '18' |
| 84 | + cache: 'pnpm' |
| 85 | + |
| 86 | + - name: Install deps |
| 87 | + run: pnpm install |
| 88 | + |
| 89 | + - name: Build and test Packages |
| 90 | + run: | |
| 91 | + git fetch origin canary |
| 92 | + npx nx affected -t pre-release --parallel=3 --exclude='*,!tag:package' --base=origin/canary --head=${{ github.ref }} |
| 93 | +
|
| 94 | + - name: Release |
| 95 | + uses: web-infra-dev/actions@v2 |
| 96 | + with: |
| 97 | + version: ${{ github.event.inputs.version || 'next' }} |
| 98 | + branch: ${{ github.event.inputs.branch }} |
| 99 | + type: 'release' |
| 100 | + tools: 'changeset' |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} |
| 103 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 104 | + REPOSITORY: ${{ github.repository }} |
| 105 | + REF: ${{ github.ref }} |
0 commit comments