|
| 1 | +name: Release Candidates |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: write |
| 8 | + |
| 9 | +jobs: |
| 10 | + release: |
| 11 | + name: Release Candidate |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout Repo |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: ${{ github.head_ref }} |
| 19 | + |
| 20 | + - uses: pnpm/action-setup@v3 |
| 21 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') }} |
| 22 | + |
| 23 | + - name: Setup Node.js 20 |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') || contains( github.event.pull_request.labels.*.name, 'python-rc') }} |
| 26 | + with: |
| 27 | + node-version: 20 |
| 28 | + registry-url: https://registry.npmjs.org |
| 29 | + cache: pnpm |
| 30 | + |
| 31 | + - name: Configure pnpm |
| 32 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') }} |
| 33 | + run: | |
| 34 | + pnpm config set auto-install-peers true |
| 35 | + pnpm config set exclude-links-from-lockfile true |
| 36 | +
|
| 37 | + - name: Install dependencies |
| 38 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') }} |
| 39 | + run: pnpm install --frozen-lockfile |
| 40 | + |
| 41 | + - name: Release JS Candidate |
| 42 | + working-directory: js |
| 43 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') }} |
| 44 | + run: | |
| 45 | + npm version prerelease --preid=${{ github.head_ref }} |
| 46 | + npm publish --tag rc |
| 47 | + env: |
| 48 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 49 | + |
| 50 | + - name: Set up Python |
| 51 | + uses: actions/setup-python@v4 |
| 52 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'python-rc') }} |
| 53 | + with: |
| 54 | + python-version: "3.10" |
| 55 | + |
| 56 | + - name: Install and configure Poetry |
| 57 | + uses: snok/install-poetry@v1 |
| 58 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'python-rc') }} |
| 59 | + with: |
| 60 | + version: 1.5.1 |
| 61 | + virtualenvs-create: true |
| 62 | + virtualenvs-in-project: true |
| 63 | + installer-parallel: true |
| 64 | + |
| 65 | + - name: Release Candidate |
| 66 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'python-rc') }} |
| 67 | + working-directory: /python |
| 68 | + run: | |
| 69 | + poetry version prerelease |
| 70 | + poetry build |
| 71 | + poetry config pypi-token.pypi ${PYPI_TOKEN} && poetry publish --skip-existing |
| 72 | + env: |
| 73 | + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
| 74 | + |
| 75 | + - name: Commit new versions |
| 76 | + if: ${{ contains( github.event.pull_request.labels.*.name, 'js-rc') || contains( github.event.pull_request.labels.*.name, 'python-rc') }} |
| 77 | + run: | |
| 78 | + git config user.name "github-actions[bot]" |
| 79 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 80 | + git commit -am "[skip ci] Release new versions" || exit 0 |
| 81 | + git push |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments