|
| 1 | +name: Fusion React Components Pre-Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - main |
| 7 | + |
| 8 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + release-pkg: |
| 15 | + name: Version or publish pre-release of packages |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + published: ${{ steps.changesets.outputs.published }} |
| 19 | + hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Validate pre-release configuration |
| 26 | + id: tag |
| 27 | + run: | |
| 28 | + if [ ! -f ".changeset/pre.json" ]; then |
| 29 | + echo "Error: .changeset/pre.json is required for pre-release workflow" |
| 30 | + exit 1 |
| 31 | + fi |
| 32 | + TAG=$(node -p "require('./.changeset/pre.json').tag") |
| 33 | + echo "tag=$TAG" >> $GITHUB_OUTPUT |
| 34 | + echo "Using tag from pre.json: $TAG" |
| 35 | +
|
| 36 | + - name: Setup node and install deps |
| 37 | + uses: ./.github/workflows/actions/node-setup |
| 38 | + |
| 39 | + - name: Create Release Pull Request or Publish to npm |
| 40 | + id: changesets |
| 41 | + uses: changesets/action@v1 |
| 42 | + with: |
| 43 | + title: '🤖 Bip Bop - Fusion React Components Pre-Release' |
| 44 | + version: pnpm changeset:version |
| 45 | + publish: pnpm changeset:publish:pre-release --tag ${{ steps.tag.outputs.tag }} |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ github.token }} |
| 48 | + NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
| 49 | + |
| 50 | + - name: convert Changeset PR to draft |
| 51 | + if: steps.changesets.outputs.published == 'false' && steps.changesets.outputs.pullRequestNumber |
| 52 | + run: gh pr ready ${{ steps.changesets.outputs.pullRequestNumber }} --undo |
| 53 | + env: |
| 54 | + GH_TOKEN: ${{ github.token }} |
| 55 | + |
0 commit comments