Skip to content

chore(new-release) #3250

chore(new-release)

chore(new-release) #3250

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
detect-visual-changes:
name: Detect visual changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.filter.outputs.styles == 'true' || steps.filter.outputs.runtime == 'true' || steps.filter.outputs.tests == 'true' || steps.filter.outputs.infrastructure == 'true' }}
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v4
- name: 🔎 Detect visual changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
styles:
- 'packages/stacks-classic/lib/**/*.less'
runtime:
- 'packages/stacks-classic/lib/index.ts'
- 'packages/stacks-classic/lib/esm-no-css.ts'
- 'packages/stacks-classic/lib/controllers.ts'
- 'packages/stacks-classic/lib/stacks.ts'
- 'packages/stacks-classic/lib/components/**/!(*.test|*.test.setup|*.fixtures).ts'
tests:
- 'packages/stacks-classic/lib/**/*.visual.test.ts'
- 'packages/stacks-classic/lib/**/*.test.setup.ts'
- 'packages/stacks-classic/lib/**/*.fixtures.ts'
- 'packages/stacks-classic/lib/test/test-utils.ts'
- 'packages/stacks-classic/lib/test/visual-test-utils.ts'
infrastructure:
- '.gitattributes'
- '.github/workflows/main.yml'
- '.github/workflows/test.yml'
- 'package.json'
- 'packages/stacks-classic/package.json'
- 'packages/stacks-classic/run-test-visual.ps1'
- 'packages/stacks-classic/screenshots/**'
- 'packages/stacks-classic/web-test-runner.config.mjs'
- 'packages/stacks-classic/web-test-runner.config.ci.mjs'
build-and-test:
name: ${{ matrix.command_description }}
uses: ./.github/workflows/test.yml
strategy:
fail-fast: false
matrix:
include:
- command_description: Build
command: npm run build
needs_lfs: false
needs_playwright: false
- command_description: Lint
command: npm run lint
needs_lfs: false
needs_playwright: false
- command_description: Less Tests
command: npm run test:less -w packages/stacks-classic
needs_lfs: false
needs_playwright: false
- command_description: Unit Tests
command: npm run test:unit -w packages/stacks-classic -- --config web-test-runner.config.ci.mjs
needs_lfs: false
needs_playwright: true
- command_description: A11y Tests
command: npm run test:a11y -w packages/stacks-classic -- --config web-test-runner.config.ci.mjs
needs_lfs: false
needs_playwright: true
- command_description: Package Tests (stacks-classic)
command: npm run test:package -w packages/stacks-classic
needs_lfs: false
needs_playwright: true
- command_description: Unit Tests (stacks-svelte)
command: npm run test -w packages/stacks-svelte
needs_lfs: false
needs_playwright: true
- command_description: Unit Tests (stacks-utils)
command: npm run test -w packages/stacks-utils
needs_lfs: false
needs_playwright: false
- command_description: Package Tests (stacks-utils)
command: npm run test:package -w packages/stacks-utils
needs_lfs: false
needs_playwright: false
- command_description: Unit Tests (stacks-docs)
command: npm run test -w packages/stacks-docs
needs_lfs: false
needs_playwright: false
- command_description: Unit Tests (stacks-email)
command: npm run test -w packages/stacks-email
needs_lfs: false
needs_playwright: false
with:
command: ${{ matrix.command }}
command_description: ${{ matrix.command_description }}
needs_playwright: ${{ matrix.needs_playwright }}
needs_lfs: ${{ matrix.needs_lfs }}
secrets: inherit
visual-regression-tests:
name: Visual Regression Tests
needs: detect-visual-changes
if: ${{ always() }}
uses: ./.github/workflows/test.yml
with:
command: npm run test:visual:ci -w packages/stacks-classic -- --config ./visual-runner/stacks-classic-runner-config/web-test-runner.config.ci.mjs
command_description: Visual Regression Tests
needs_lfs: true
needs_playwright: false # we are using playwright docker image to run visual tests
should_run: ${{ needs.detect-visual-changes.result != 'success' || needs.detect-visual-changes.outputs.should_run == 'true' }}
secrets: inherit
release:
name: "Release (main)"
if: ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build-and-test.result == 'success' && (needs.visual-regression-tests.result == 'success' || needs.visual-regression-tests.result == 'skipped') }}
needs: [build-and-test, visual-regression-tests]
runs-on: ubuntu-latest
timeout-minutes: 20
env:
BETTER_AUTH_SECRET: ${{ secrets.AUTH_SECRET || 'ci-build-placeholder-secret' }}
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- uses: actions/checkout@v5
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "npm"
- name: Install dependencies
run: |
npm ci
npm run build
- name: 🚀 Create/Update Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: npm run version
publish: npm run release
title: "chore(new-release)"
commit: "chore(new-release)"
branch: main
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.STACKS_TOOLING_GH_RW_PAT }}
NPM_TOKEN: ${{ secrets.NPM_API_KEY }}
- name: Docs on Release Pull Request
# run only if there is a release pull request open
if: steps.changesets.outputs.pullRequestNumber
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: "pr-release-docs"
pr-number: ${{ steps.changesets.outputs.pullRequestNumber }}
message: |
To trigger the build for this PR, **close and re-open it**.
This is necessary because the PR is updated by github-actions[bot].
This is a technical user which does not trigger actions workflows on push events.
See this GH issue for more details: https://github.com/changesets/action/issues/187
- name: Deploy docs site
if: steps.changesets.outputs.published == 'true'
run: bash .github/scripts/deploy-netlify.sh
env:
NETLIFY_API_TOKEN: ${{ secrets.NETLIFY_API_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_BRANCH: main
NETLIFY_DEPLOY_TITLE: Release docs deploy
# cancel the jobs if another workflow is kicked off for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}