🚑 - fix: attempted hotfix for failing CI #1174
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: Run CI build and tests | |
| # Run this workflow every time a new commit pushed to your repository | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| workflow_dispatch: | |
| concurrency: | |
| group: '${{ github.workflow }}-${{ github.ref_name }}' # unique builds for branch/tag name | |
| cancel-in-progress: false # do not cancel in progress, but only in-between builds | |
| jobs: | |
| build: | |
| name: Create 'production' build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build source | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=4096" | |
| run: npm run build | |
| - name: build package | |
| run: npm pack | |
| - name: Store build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build | |
| path: maykin-ui-admin-ui-*.tgz | |
| retention-days: 1 | |
| commitlint: | |
| name: Validate the commit messages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install commitlint | |
| run: | | |
| npm install conventional-changelog-conventionalcommits | |
| npm install commitlint@latest | |
| - name: Validate PR commits with commitlint | |
| if: github.event_name == 'pull_request' | |
| run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
| lint: | |
| name: Run linters | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linters | |
| run: npm run lint | |
| test: | |
| name: Run tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright and browsers | |
| run: npx playwright install --with-deps | |
| - name: Run tests | |
| run: npm run test:coverage | |
| - name: Publish coverage report | |
| uses: codecov/[email protected] | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build Storybook | |
| run: npm run build-storybook --quiet | |
| - name: Publish to Chromatic | |
| uses: chromaui/action@latest | |
| with: | |
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
| autoAcceptChanges: "main" | |
| onlyChanged: true | |
| i18n-check: | |
| name: Check for missing translations | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Make and compile messages | |
| run: | | |
| npm run makemessages | |
| npm run compilemessages | |
| - name: Check for uncommitted changes | |
| run: | | |
| # Check for changes in the repo | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "There are uncommitted changes. Stopping the workflow." | |
| exit 1 | |
| fi | |
| publish: | |
| name: Publish the NPM package | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - commitlint | |
| - lint | |
| - test | |
| - i18n-check | |
| # do not publish in forks or non-tag pushes | |
| if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'maykinmedia' | |
| environment: | |
| name: release | |
| url: https://www.npmjs.com/package/@maykin-ui/admin-ui | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update NPM | |
| run: npm install -g npm@latest | |
| - name: Download build artifact | |
| id: download | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build | |
| path: artifacts | |
| - name: Publish package to NPM | |
| run: | | |
| shopt -s nocasematch | |
| VERSION=$(node -p "require('./package.json').version") | |
| TAG="latest" | |
| if [[ "$VERSION" == *alpha* ]]; then | |
| TAG="alpha" | |
| elif [[ "$VERSION" == *beta* ]]; then | |
| TAG="beta" | |
| fi | |
| FILE=$(ls artifacts/*.tgz) | |
| echo "Publishing version $VERSION with tag $TAG" | |
| npm publish "$FILE" --access public --tag $TAG |