name: services/www - releases/required on: push: branches: ['releases/www/**'] workflow_dispatch: concurrency: group: ci-www-rel-${{ github.ref_name }} cancel-in-progress: true permissions: contents: read actions: read jobs: setup-stage: name: Setup - Stage runs-on: ubuntu-latest outputs: cache-hit: ${{ steps.cache-pnpm-store.outputs.cache-hit }} steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - name: Setup Node.js with pnpm cache uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Cache pnpm store id: cache-pnpm-store uses: actions/cache@v3 with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - name: Install dependencies run: pnpm install --frozen-lockfile build-configs: name: Build - Configs needs: setup-stage runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build Rsbuild config run: pnpm --filter @ermnvldmr/rsbuild-config build - name: Build Storybook config run: pnpm --filter @ermnvldmr/storybook-config build - name: Build i18n run: pnpm --filter @ermnvldmr/i18n build - name: Upload Config Artifacts uses: actions/upload-artifact@v4 with: name: config-artifacts path: | packages/rsbuild-config/dist packages/storybook-config/dist packages/i18n/dist retention-days: 1 lint-www: name: Lint - WWW needs: build-configs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Lint WWW service run: pnpm --filter @ermnvldmr/www lint typecheck-www: name: Typecheck - WWW needs: build-configs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Typecheck WWW service run: pnpm --filter @ermnvldmr/www typecheck build-storybook: name: Build - Storybook needs: build-configs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Build WWW Storybook run: pnpm --filter @ermnvldmr/www build-storybook - name: Upload Storybook build uses: actions/upload-artifact@v4 with: name: storybook-static path: services/www/storybook-static/ retention-days: 1 test-www: name: Test - Unit needs: build-configs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Test WWW service run: pnpm --filter @ermnvldmr/www test:coverage test-storybook: name: Test - Storybook needs: build-storybook runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Install Playwright browsers run: pnpm --filter @ermnvldmr/www exec playwright install --with-deps chromium - name: Download Storybook build uses: actions/download-artifact@v4 with: name: storybook-static path: services/www/storybook-static/ - name: Serve Storybook and run tests run: pnpm --filter @ermnvldmr/www test:storybook:ci build-www: name: Build - WWW Service needs: build-configs runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 9.12.3 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Download Config Artifacts uses: actions/download-artifact@v4 with: name: config-artifacts path: packages - name: Build WWW service run: pnpm --filter @ermnvldmr/www build release-rc-docker: name: Release - RC Docker Image needs: build-www runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Calculate RC Version id: version run: | RC_VERSION=$(bash ci/scripts/semantic-release.sh rc ${{ github.ref_name }}) echo "rc_version=$RC_VERSION" >> $GITHUB_OUTPUT - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }}/www tags: | type=raw,value=v${{ steps.version.outputs.rc_version }} type=sha,format=short - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ci/docker/www/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}