fix issue #6
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 | |
| on: | |
| push: | |
| branches: | |
| - oidc_publish_changes | |
| tags-ignore: | |
| - '**' | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| release-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm install | |
| - run: node ./scripts/stableReleaseCheck.js | |
| publish-package-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install NPM package | |
| run: npm install | |
| - name: get version | |
| id: fdk-cli-version | |
| uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
| - name: Build the project | |
| run: npm run build | |
| - name: Installing sentry | |
| run: npm i -g @sentry/cli@2.28.6 | |
| - name: Add Debug Id to dist | |
| run: sentry-cli sourcemaps inject --org ${{ env.SENTRY_ORG }} --project ${{ env.SENTRY_PROJECT }} ./dist | |
| env: | |
| SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
| - name: create sentry.io release | |
| uses: getsentry/action-release@v1 | |
| env: | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
| with: | |
| environment: production | |
| sourcemaps: './dist' | |
| version: ${{ steps.fdk-cli-version.outputs.current-version }} | |
| - name: Adding Sentry DSN | |
| run: | | |
| echo "{\"dsn\": \"${{ secrets.SENTRY_DSN }}\"}" > ./dist/sentry.json | |
| - name: Delete SourceMap files | |
| run: find ./dist -type f -name '*.map' -exec rm -f {} \; | |
| - name: Remove token-based authentication from .npmrc | |
| run: | | |
| NPMRC_PATH=$(npm config get userconfig 2>/dev/null || echo "/home/runner/work/_temp/.npmrc") | |
| if [ -f "$NPMRC_PATH" ]; then | |
| sed -i.bak '/_authToken/d' "$NPMRC_PATH" 2>/dev/null || true | |
| fi | |
| # Also check temp directory | |
| if [ -f "/home/runner/work/_temp/.npmrc" ]; then | |
| sed -i.bak '/_authToken/d' "/home/runner/work/_temp/.npmrc" 2>/dev/null || true | |
| fi | |
| - name: Publish to npmjs | |
| run: npm publish --access public |