-
Notifications
You must be signed in to change notification settings - Fork 6
chore: normaliza repository url #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2c3a686
c263cad
5202835
6ae2c29
9adeca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,30 @@ | ||
| name: Publish | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| publish-type: | ||
| description: 'Type of publish: "canary" or "release"' | ||
| required: true | ||
| type: string | ||
| pr-number: | ||
| description: 'PR number for canary releases' | ||
| required: false | ||
| type: number | ||
| outputs: | ||
| published: | ||
| description: 'Whether a release was published' | ||
| value: ${{ jobs.publish-release.outputs.published || 'false' }} | ||
| version: | ||
| description: 'Published version' | ||
| value: ${{ jobs.publish-canary.outputs.version || jobs.publish-release.outputs.version || '' }} | ||
| pull_request: | ||
| paths-ignore: | ||
| - '.changeset/**' | ||
| - '.husky/**' | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: | ||
| group: publish-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write # Required for trusted publishing (OIDC) | ||
|
|
||
| jobs: | ||
| publish-canary: | ||
| name: 'Publish canary' | ||
| if: inputs.publish-type == 'canary' | ||
| name: 'Build & canary release' | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| id-token: write # Required for trusted publishing (OIDC) | ||
| environment: | ||
| name: Canary package in NPM | ||
| url: https://www.npmjs.com/package/@cube-dev/ui-kit/v/${{ steps.version.outputs.version }} | ||
| env: | ||
| NODE_OPTIONS: --max-old-space-size=4096 | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
|
|
@@ -64,6 +54,11 @@ jobs: | |
| - name: Update npm for trusted publishing | ||
| run: npm install -g npm@latest | ||
|
|
||
| - name: Verify npm version and OIDC availability | ||
| run: | | ||
| echo "npm version: $(npm --version)" | ||
| echo "OIDC available: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }}" | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
|
|
@@ -81,9 +76,12 @@ jobs: | |
| - name: Build project | ||
| run: pnpm build | ||
|
|
||
| - name: Clear .npmrc auth token (use OIDC instead) | ||
| run: npm config delete //registry.npmjs.org/:_authToken || true | ||
|
|
||
| - name: Publish canary to npm | ||
| working-directory: ./dist | ||
| run: npm publish --access public --tag pr_${{ inputs.pr-number }} | ||
| run: npm publish --access public --tag pr_${{ github.event.number }} --provenance | ||
|
|
||
| - name: Comment PR | ||
| uses: actions/github-script@v6 | ||
|
|
@@ -97,22 +95,17 @@ jobs: | |
| body: 'Deployed canary version [${{ steps.version.outputs.version }}](https://www.npmjs.com/package/@cube-dev/ui-kit/v/${{ steps.version.outputs.version }}).', | ||
| github, | ||
| repo: context.repo, | ||
| prNumber: ${{ inputs.pr-number }} | ||
| prNumber: ${{ github.event.number }} | ||
| }) | ||
|
|
||
| publish-release: | ||
| name: 'Publish release' | ||
| if: inputs.publish-type == 'release' | ||
| if: github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write # Required for trusted publishing (OIDC) | ||
| env: | ||
| NODE_OPTIONS: --max-old-space-size=4096 | ||
| outputs: | ||
| published: ${{ steps.changesets.outputs.published }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing fallback for
|
||
| version: ${{ steps.get-version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
|
|
@@ -142,9 +135,17 @@ jobs: | |
| - name: Update npm for trusted publishing | ||
| run: npm install -g npm@latest | ||
|
|
||
| - name: Verify npm version and OIDC availability | ||
| run: | | ||
| echo "npm version: $(npm --version)" | ||
| echo "OIDC available: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }}" | ||
|
|
||
| - name: Install Dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Clear .npmrc auth token (use OIDC instead) | ||
| run: npm config delete //registry.npmjs.org/:_authToken || true | ||
|
|
||
| - name: Create Release Pull Request or Publish to npm | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
|
|
@@ -155,9 +156,60 @@ jobs: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # NPM_TOKEN not needed - using trusted publishing (OIDC) | ||
|
|
||
| - name: Get published version | ||
| id: get-version | ||
| if: steps.changesets.outputs.published == 'true' | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| deploy-chromatic-release: | ||
| name: 'Deploy storybook to Chromatic' | ||
| needs: publish-release | ||
| if: github.event_name == 'push' && needs.publish-release.outputs.published == 'false' | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: Chromatic Production | ||
| url: ${{ steps.publish_chromatic.outputs.url }} | ||
| env: | ||
| NODE_OPTIONS: --max-old-space-size=4096 | ||
| CHROMATIC_RETRIES: 5 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Update Corepack | ||
| run: npm i -g corepack@latest | ||
|
|
||
| - name: Enable Corepack (pre) | ||
| run: corepack enable | ||
|
|
||
| - name: Prepare pnpm (pre) | ||
| run: corepack prepare [email protected] --activate | ||
|
|
||
| - uses: actions/cache@v4 | ||
| name: Download storybook cache | ||
| with: | ||
| path: | | ||
| **/node_modules/.cache | ||
| key: ${{ runner.os }}-storybook-${{ github.run_id }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-storybook | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Prepare pnpm | ||
| run: corepack prepare [email protected] --activate | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Publish to Chromatic | ||
| id: publish_chromatic | ||
| uses: chromaui/action@v11 | ||
| with: | ||
| exitZeroOnChanges: true | ||
| exitOnceUploaded: true | ||
| autoAcceptChanges: true | ||
| onlyChanged: true | ||
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: OIDC availability check always evaluates to false
The OIDC verification step uses
${{ env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }}to check OIDC availability, but this will always evaluate tofalse. TheACTIONS_ID_TOKEN_REQUEST_URLis a runtime environment variable injected by GitHub Actions infrastructure, not accessible via the workflow'senvcontext (which only includes variables defined inenv:blocks). To check this variable, shell syntax like$ACTIONS_ID_TOKEN_REQUEST_URLmust be used instead of the expression context. The diagnostic output will always show "OIDC available: false" regardless of actual OIDC availability, providing misleading information during troubleshooting.Additional Locations (1)
.github/workflows/publish.yml#L149-L153