|
| 1 | +name: 🦋 Changesets Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + name: 🦋 Changesets Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + if: | |
| 13 | + github.repository == 'supabase-community/supabase-management-js' |
| 14 | + outputs: |
| 15 | + published_packages: ${{ steps.changesets.outputs.publishedPackages }} |
| 16 | + published: ${{ steps.changesets.outputs.published }} |
| 17 | + steps: |
| 18 | + - name: 🛑 Cancel Previous Runs |
| 19 | + |
| 20 | + |
| 21 | + - name: ⬇️ Checkout repo |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: ⎔ Setup node |
| 27 | + uses: actions/setup-node@v2 |
| 28 | + with: |
| 29 | + node-version: 18 |
| 30 | + cache: "npm" |
| 31 | + |
| 32 | + - name: 📥 Download deps |
| 33 | + run: npm install |
| 34 | + |
| 35 | + - name: 🔎 Type check |
| 36 | + run: npm run typecheck |
| 37 | + |
| 38 | + - name: 🔐 Setup npm auth |
| 39 | + run: | |
| 40 | + echo "registry=https://registry.npmjs.org" >> ~/.npmrc |
| 41 | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc |
| 42 | +
|
| 43 | + # This action has two responsibilities. The first time the workflow runs |
| 44 | + # (initial push to the `main` branch) it will create a new branch and |
| 45 | + # then open a PR with the related changes for the new version. After the |
| 46 | + # PR is merged, the workflow will run again and this action will build + |
| 47 | + # publish to npm. |
| 48 | + - name: 🚀 PR / Publish |
| 49 | + id: changesets |
| 50 | + uses: changesets/action@v1 |
| 51 | + with: |
| 52 | + version: npm run changeset:version |
| 53 | + commit: "chore: Update version for release" |
| 54 | + title: "chore: Update version for release" |
| 55 | + publish: npm run changeset:release |
| 56 | + createGithubReleases: true |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments