ci: inline clear NODE_AUTH_TOKEN #362
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 updated packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write # Required publishing to npm using OIDC | |
| contents: read | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Setup .npmrc file to publish to npm | |
| - name: Enable corepack | |
| run: corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "yarn" | |
| cache-dependency-path: "**/yarn.lock" | |
| registry-url: "https://registry.npmjs.org" | |
| scope: "@reflag" | |
| - name: update npm - remove this once we upgrade Node.js | |
| run: npm install -g npm@11.8.0 | |
| - name: npm version | |
| run: npm version | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Build packages | |
| run: yarn build | |
| - name: Prepare npmrc for OIDC | |
| run: | | |
| echo "@reflag:registry=https://registry.npmjs.org/" > "${RUNNER_TEMP}/.npmrc" | |
| - name: Debug npm auth (non-fatal) | |
| run: | | |
| npm --version | |
| npm config get userconfig | |
| npm config get registry | |
| npm whoami --registry https://registry.npmjs.org || true | |
| - name: Publish | |
| run: NODE_AUTH_TOKEN="" yarn lerna publish from-package --no-private --yes | |
| env: | |
| NPM_CONFIG_USERCONFIG: "${{ runner.temp }}/.npmrc" | |
| NPM_CONFIG_PROVENANCE: "true" | |
| NPM_CONFIG_ACCESS: "public" | |
| - name: Build docs | |
| run: yarn docs | |
| - name: Checkout docs with SSH | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: reflagcom/docs | |
| ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }} | |
| path: reflag-docs | |
| - name: Copy generated docs to docs repo | |
| run: | | |
| rm -rf reflag-docs/sdk | |
| cp -R dist/docs reflag-docs/sdk | |
| - name: Commit and push changes | |
| run: | | |
| cd reflag-docs | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@reflag.com" | |
| git add sdk | |
| git commit -m "Update documentation" && git push || echo "No docs changes to commit" |