fix: configure npm registry URL and OIDC authentication in release wo… #266
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 | |
| - stage | |
| permissions: write-all | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Configure npm for OIDC | |
| run: | | |
| npm config set //registry.npmjs.org/:_authToken "" | |
| npm config set provenance true | |
| - name: Install | |
| run: npm install | |
| - name: Build | |
| run: npm run compile | |
| - name: Release | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
| sync-stage: | |
| needs: release | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} | |
| - name: Set up Git | |
| run: | | |
| git config user.name "GitHub Action" | |
| git config user.email "action@github.com" | |
| - name: Merge main into stage | |
| run: | | |
| git fetch origin | |
| git pull origin main | |
| git checkout stage | |
| git merge main --allow-unrelated-histories --no-edit -Xtheirs -m "Merge branch 'main' into stage [skip ci]" | |
| git push origin stage |