chore(release): publish (#790) #306
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - .changeset/** | |
| workflow_dispatch: | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| contents: write | |
| id-token: write # Required for OIDC | |
| issues: read | |
| pull-requests: write | |
| env: | |
| NODE_VERSION: 22 | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'capawesome-team/capacitor-plugins' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Update npm for OIDC trusted publishing | |
| run: | | |
| # npm trusted publishing requires npm >= 11.5.1 | |
| # Node.js 20.x ships with npm 10.x, so we need to update | |
| echo "Current npm version: $(npm --version)" | |
| npm install -g npm@latest | |
| echo "Updated npm version: $(npm --version)" | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: npm run release | |
| commit: "chore(release): publish" | |
| title: "chore(release): publish" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set npm token for GitHub Packages | |
| if: steps.changesets.outputs.published == 'true' | |
| run: npm config set //npm.pkg.github.com/:_authToken ${{ secrets.PAT }} | |
| - name: Publish Sponsorware to GitHub Packages | |
| if: steps.changesets.outputs.published == 'true' | |
| run: node ./scripts/publish-sponsorware.mjs --packages='${{ steps.changesets.outputs.publishedPackages }}' |