feat: add github registry support #1321
Workflow file for this run
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: CI/CD Pipeline | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| ci: | |
| name: 🔄 Continuous Integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify core/react version parity | |
| run: | | |
| CORE_VERSION=$(jq -r '.version' packages/core/package.json) | |
| REACT_VERSION=$(jq -r '.version' packages/react/package.json) | |
| if [ "$CORE_VERSION" != "$REACT_VERSION" ]; then | |
| echo "::error::Version mismatch — core@$CORE_VERSION != react@$REACT_VERSION. Both packages must have the same version." | |
| exit 1 | |
| fi | |
| echo "Version parity OK: $CORE_VERSION" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@36de12bed180fa130ed56a35e7344f2fa7a820ab # v4 | |
| with: | |
| version: 10.6.5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check formatting | |
| run: pnpm format:check | |
| - name: Run linting | |
| run: pnpm lint | |
| - name: Type check | |
| run: pnpm type-check | |
| - name: Run tests | |
| run: pnpm test | |
| - name: Build packages | |
| run: pnpm build | |
| - name: Check registry.json is up to date | |
| run: | | |
| pnpm --filter @auth0/universal-components-react registry:generate | |
| if ! git diff --exit-code packages/react/registry.json; then | |
| echo "::error::registry.json is out of date. Run 'pnpm --filter @auth0/universal-components-react registry:generate' and commit the result." | |
| exit 1 | |
| fi | |
| - name: Validate shadcn registry | |
| run: pnpm dlx shadcn@latest registry validate | |
| notify: | |
| name: Slack Notification | |
| needs: [ci] | |
| if: always() | |
| runs-on: | |
| labels: ubuntu-latest | |
| steps: | |
| - name: Send Slack notification | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_CI_WORKFLOW_WEBHOOK }} | |
| CI_RESULT: ${{ needs.ci.result }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_WORKFLOW: ${{ github.workflow }} | |
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| COMMIT_SHA: ${{ github.sha }} | |
| GITHUB_SERVER_URL: ${{ github.server_url }} | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| run: | | |
| echo "Preparing Slack notification..." | |
| # Determine overall status | |
| if [[ "$CI_RESULT" == "success" ]]; then | |
| STATUS="✅ SUCCESS: CI/CD Pipeline passed" | |
| MESSAGE="All checks passed successfully" | |
| else | |
| STATUS="❌ FAILED: CI/CD Pipeline failed" | |
| MESSAGE="One or more CI steps failed. Check the workflow run for details." | |
| fi | |
| # Output summary for GitHub logs | |
| echo "=== WORKFLOW SUMMARY ===" | |
| echo "Status: $STATUS" | |
| echo "CI Result: $CI_RESULT" | |
| echo "" | |
| # Send notification to Slack (if webhook is configured) | |
| if [ -n "$SLACK_WEBHOOK" ]; then | |
| echo "Sending Slack notification..." | |
| HTTP_CODE=$(curl -X POST "$SLACK_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -w "%{http_code}" \ | |
| -o /tmp/slack_response.txt \ | |
| -d "{ | |
| \"status\": \"$STATUS\", | |
| \"message\": \"$MESSAGE\", | |
| \"repository\": \"${GITHUB_REPOSITORY}\", | |
| \"branch\": \"${GITHUB_BRANCH}\", | |
| \"ci_result\": \"$CI_RESULT\", | |
| \"actor\": \"${GITHUB_ACTOR}\", | |
| \"workflow\": \"${GITHUB_WORKFLOW}\", | |
| \"commit_message\": \"${COMMIT_MESSAGE}\", | |
| \"commit_sha\": \"${COMMIT_SHA}\", | |
| \"action_url\": \"${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}\" | |
| }") | |
| if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then | |
| echo "Slack notification sent successfully (HTTP $HTTP_CODE)" | |
| else | |
| echo "WARNING: Slack notification failed (HTTP $HTTP_CODE)" | |
| cat /tmp/slack_response.txt | |
| fi | |
| else | |
| echo "Slack webhook not configured, skipping notification" | |
| fi | |
| # CD job to be configured later | |
| # cd: | |
| # name: 📦 Continuous Deployment | |
| # needs: [ci] | |
| # if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| # runs-on: ubuntu-latest | |
| # environment: production | |
| # concurrency: | |
| # group: production | |
| # cancel-in-progress: false | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: '22' | |
| # cache: 'pnpm' | |
| # - name: Deploy | |
| # run: echo "Deployment steps will go here" |