Merge pull request #18 from wireweave/develop #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm for trusted publishing | |
| run: npm install -g npm@latest | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.11.0 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Publish Beta (develop branch) | |
| if: github.ref == 'refs/heads/develop' && !contains(github.event.head_commit.message, '[skip ci]') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx release-it --preRelease=beta --ci | |
| - name: Publish Release (main branch) | |
| if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx release-it --ci | |
| - name: Sync main to develop | |
| if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') | |
| run: | | |
| git fetch origin develop | |
| git checkout develop | |
| git merge main --strategy-option theirs -m "chore: sync release from main [skip ci]" | |
| git push origin develop |