name: Release on: workflow_run: workflows: - CI branches: - main types: - completed jobs: release: name: Release # run only if the CI workflow is successful if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: - name: ⬇️ Checkout uses: actions/checkout@v3 # make sure to checkout the commit that triggered the CI workflow # (which is not necessarily the latest commit) with: ref: ${{ github.event.workflow_run.head_commit.id }} - name: ⎔ Setup node uses: actions/setup-node@v3 with: node-version: 'lts/*' - name: 🏗 Install and Build run: | npm ci npm run build - name: 🚀 Create/Update Release Pull Request or Publish to npm id: changesets uses: changesets/action@v1 with: publish: npm run release title: 'chore(new-release)' commit: 'chore(new-release)' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_API_KEY }} # cancel the jobs if another workflow is kicked off for the same branch concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true