Updates design on single and multi-select, and status components #4542
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: Deploy canary releases and update example apps on Github pages | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize # canary on new commit | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| stencil-library-release: | |
| outputs: | |
| CANARY_VERSION: ${{ steps.build.outputs.CANARY_VERSION }} | |
| SKIP_REMAINING: ${{ steps.build.outputs.SKIP_REMAINING }} | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" # job will not run, if triggered via ship-it | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| fetch-depth: 0 # fetch all tags for ship-it | |
| - name: download + setup auto | |
| uses: auto-it/setup-auto@v1 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: "https://registry.npmjs.org" | |
| cache: 'npm' | |
| - name: Install jq | |
| run: | | |
| if command -v jq &> /dev/null; then | |
| echo "✅ jq is already installed: $(jq --version)" | |
| else | |
| echo "📦 Installing jq..." | |
| sudo apt-get update && sudo apt-get install -y jq | |
| fi | |
| - name: Cache node modules | |
| id: cache-npm | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.npm | |
| **/node_modules | |
| key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/lerna.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}- | |
| ${{ runner.os }}-build- | |
| - name: Install dependencies for all packages | |
| run: | | |
| npm ci | |
| - name: Run tests | |
| run: | | |
| cd packages/components | |
| npm test | |
| - name: Build and deploy Stencil core package | |
| id: build | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| npm run build:components | |
| if [ "${{ github.actor }}" = "dependabot[bot]" ]; then | |
| echo "Skipping creation of a canary release due to workflow trigger being a Dependabot PR" | |
| echo "SKIP_REMAINING=true" >> $GITHUB_OUTPUT | |
| else | |
| cd packages/components | |
| CANARY_VERSION=$(auto shipit --dry-run --quiet) | |
| echo "CANARY_VERSION=$CANARY_VERSION" >> $GITHUB_ENV | |
| echo "CANARY_VERSION=$CANARY_VERSION" >> $GITHUB_OUTPUT | |
| echo "SKIP_REMAINING=false" >> $GITHUB_OUTPUT | |
| echo "WEBEX_MESSAGE=New package release - Version: $CANARY_VERSION" >> $GITHUB_ENV | |
| echo "Publishing: $CANARY_VERSION" | |
| auto shipit | |
| fi | |
| - name: Check package availability | |
| if: steps.build.outputs.SKIP_REMAINING == 'false' | |
| uses: ./.github/actions/check-package-availability | |
| with: | |
| package: "@infineon/infineon-design-system-stencil" | |
| version: ${{ steps.build.outputs.CANARY_VERSION }} | |
| max-attempts: 10 | |
| max-delay: 20 | |
| - name: Update Dependencies in Angular, Vue and React packages | |
| if: steps.build.outputs.SKIP_REMAINING == 'false' | |
| id: update-wrapper-dependencies | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} | |
| CANARY_VERSION: ${{ steps.build.outputs.CANARY_VERSION }} | |
| run: | | |
| echo "CANARY_VERSION: $CANARY_VERSION" | |
| echo "Installing Stencil library for Angular, Vue and React: $CANARY_VERSION" | |
| lerna version $CANARY_VERSION --no-git-tag-version --y | |
| # Update Angular package | |
| cd packages/components-angular/projects/component-library | |
| jq --arg CANARY_VERSION "$CANARY_VERSION" \ | |
| '.dependencies["@infineon/infineon-design-system-stencil"] = $CANARY_VERSION | .peerDependencies["@infineon/infineon-design-system-stencil"] = $CANARY_VERSION' \ | |
| package.json > tmp && mv tmp package.json | |
| cd ../../../../ | |
| # Update Vue package | |
| cd packages/components-vue | |
| CANARY_VERSION_CLEAN=$(echo "$CANARY_VERSION" | sed 's/^[\^~]*//') # strip any leading ^ or ~ just in case | |
| jq 'del(.dependencies["@infineon/infineon-design-system-stencil"])' package.json > tmp && mv tmp package.json | |
| jq --arg v "$CANARY_VERSION_CLEAN" '.dependencies["@infineon/infineon-design-system-stencil"] = $v' package.json > tmp && mv tmp package.json | |
| # Update React package | |
| cd ../components-react | |
| jq 'del(.dependencies["@infineon/infineon-design-system-stencil"])' package.json > tmp && mv tmp package.json | |
| jq --arg CANARY_VERSION "$CANARY_VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $CANARY_VERSION' package.json > tmp && mv tmp package.json | |
| cd ../../ | |
| npm install | |
| # Verify updates | |
| echo "Verifying updates in Angular package" | |
| jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-angular/projects/component-library/package.json | |
| echo "Verifying updates in Vue package" | |
| jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-vue/package.json | |
| echo "Verifying updates in React package" | |
| jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-react/package.json | |
| - name: Build and deploy Angular, Vue and React packages | |
| if: steps.build.outputs.SKIP_REMAINING == 'false' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| npm run build:components-angular | |
| npm run build:components-react | |
| npm run build:components-vue | |
| cd packages/components-angular/dist/@infineon/infineon-design-system-angular | |
| npm publish --tag canary | |
| cd ../../../../components-react | |
| npm publish --tag canary | |
| cd ../components-vue | |
| npm publish --tag canary | |
| - name: Verify built files | |
| run: | | |
| echo "Verifying built files in React package" | |
| ls -la packages/components-react/dist | |
| cat packages/components-react/dist/components.js | |
| - name: Update Dependencies in example applications | |
| if: steps.build.outputs.SKIP_REMAINING == 'false' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| CANARY_VERSION: ${{ steps.build.outputs.CANARY_VERSION }} | |
| run: | | |
| # Update Vue wrapper component | |
| cd examples/wrapper-components/vue-javascript | |
| jq --arg CANARY_VERSION "$CANARY_VERSION" '.dependencies["@infineon/infineon-design-system-vue"] = $CANARY_VERSION' package.json > package.json.tmp && mv package.json.tmp package.json | |
| cd ../../.. | |
| # Update React wrapper component | |
| cd examples/wrapper-components/react-vite-js | |
| jq --arg CANARY_VERSION "$CANARY_VERSION" '.dependencies["@infineon/infineon-design-system-react"] = $CANARY_VERSION' package.json > package.json.tmp && mv package.json.tmp package.json | |
| cd ../../.. | |
| - name: Commit and push all changes | |
| if: steps.build.outputs.SKIP_REMAINING == 'false' | |
| env: | |
| BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git add . | |
| git commit -m "Update Stencil library version to $CANARY_VERSION" | |
| git push origin HEAD:$BRANCH_NAME | |
| #deploy gh-pages previews for example applications: | |
| deploy-preview-vue: | |
| needs: stencil-library-release | |
| if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| deployment-url: ${{ steps.preview.outputs.deployment-url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Check package availability | |
| uses: ./.github/actions/check-package-availability | |
| with: | |
| package: "@infineon/infineon-design-system-vue" | |
| version: ${{ needs.stencil-library-release.outputs.CANARY_VERSION }} | |
| max-attempts: 10 | |
| max-delay: 20 | |
| - name: Install and Build | |
| run: | | |
| cd examples/wrapper-components/vue-javascript | |
| npm i | |
| npm run build | |
| - name: Deploy preview | |
| id: preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| source-dir: ./examples/wrapper-components/vue-javascript/dist | |
| umbrella-dir: pr-preview-vue-example | |
| token: ${{ secrets.GH_TOKEN }} | |
| deploy-preview-react: | |
| needs: stencil-library-release | |
| if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| deployment-url: ${{ steps.preview.outputs.deployment-url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Check package availability | |
| uses: ./.github/actions/check-package-availability | |
| with: | |
| package: "@infineon/infineon-design-system-react" | |
| version: ${{ needs.stencil-library-release.outputs.CANARY_VERSION }} | |
| max-attempts: 10 | |
| max-delay: 20 | |
| - name: Install and Build | |
| run: | | |
| cd examples/wrapper-components/react-vite-js | |
| rm -rf node_modules | |
| npm install | |
| REACT_VERSION=$(jq -r '.dependencies["@infineon/infineon-design-system-react"]' package.json) | |
| STENCIL_VERSION=$(npm list @infineon/infineon-design-system-stencil --depth=1 | grep @infineon/infineon-design-system-stencil@ | awk -F@ '{print $3}') | |
| echo "Installed version Stencil: $STENCIL_VERSION - Installed version React: $REACT_VERSION" | |
| npm run build | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| id: preview | |
| with: | |
| source-dir: ./examples/wrapper-components/react-vite-js/dist | |
| umbrella-dir: pr-preview-react-example | |
| token: ${{ secrets.GH_TOKEN }} | |
| deploy-preview-angular: | |
| needs: stencil-library-release | |
| if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false' | |
| outputs: | |
| deployment-url: ${{ steps.preview.outputs.deployment-url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Check package availability | |
| uses: ./.github/actions/check-package-availability | |
| with: | |
| package: "@infineon/infineon-design-system-angular" | |
| version: ${{ needs.stencil-library-release.outputs.CANARY_VERSION }} | |
| max-attempts: 10 | |
| max-delay: 20 | |
| - name: Update package.json with canary version | |
| run: | | |
| cd packages/components-angular | |
| jq --arg CANARY_VERSION "${{ needs.stencil-library-release.outputs.CANARY_VERSION }}" '.dependencies["@infineon/infineon-design-system-angular"] = $CANARY_VERSION' package.json > package.json.tmp && mv package.json.tmp package.json | |
| cd projects/component-library | |
| jq --arg CANARY_VERSION "${{ needs.stencil-library-release.outputs.CANARY_VERSION }}" '.dependencies["@infineon/infineon-design-system-stencil"] = $CANARY_VERSION' package.json > package.json.tmp && mv package.json.tmp package.json | |
| - name: Install and Build | |
| run: | | |
| cd packages/components-angular | |
| npm install | |
| npm run build my-app | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| id: preview | |
| with: | |
| source-dir: ./packages/components-angular/dist/my-app | |
| umbrella-dir: pr-preview-angular-example | |
| token: ${{ secrets.GH_TOKEN }} | |
| deploy-preview-vanilla: | |
| needs: stencil-library-release | |
| if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| deployment-url: ${{ steps.preview.outputs.deployment-url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Update CDN Link in Vanilla example app & build | |
| run: | | |
| cd examples/stencil-components/vanilla-cdn | |
| npm install | |
| npm run update-link | |
| npm run build | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| id: preview | |
| with: | |
| source-dir: ./examples/stencil-components/vanilla-cdn/dist | |
| umbrella-dir: pr-preview-vanilla-example | |
| token: ${{ secrets.GH_TOKEN }} | |
| update-pr-comment: # add comment on github | |
| needs: [deploy-preview-vue, deploy-preview-react, deploy-preview-angular, deploy-preview-vanilla] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Update comment in PR | |
| uses: actions/github-script@v4 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const vueUrl = "${{ needs.deploy-preview-vue.outputs.deployment-url }}"; | |
| const reactUrl = "${{ needs.deploy-preview-react.outputs.deployment-url }}"; | |
| const angularUrl = "${{ needs.deploy-preview-angular.outputs.deployment-url }}"; | |
| const vanillaUrl = "${{ needs.deploy-preview-vanilla.outputs.deployment-url }}"; | |
| const EXAMPLE_APPS_IDENTIFIER = "--EXAMPLE-APPS-PREVIEW--"; | |
| const newText = `--EXAMPLE-APPS-PREVIEW--\nPR Preview URLs:\n- Vue example: ${vueUrl}\n- React example: ${reactUrl}\n- Angular example: ${angularUrl}\n- Vanilla example: ${vanillaUrl}`; | |
| const {data: comments} = await github.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber | |
| }); | |
| const appsComment = comments.find(c => c.body.startsWith(EXAMPLE_APPS_IDENTIFIER)); | |
| if (appsComment) { | |
| await github.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: appsComment.id, | |
| body: newText | |
| }); | |
| } else { | |
| await github.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: newText | |
| }); | |
| } | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |