|
| 1 | +name: release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*.*.*' |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-and-publish: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - uses: actions/setup-node@v4 |
| 13 | + with: |
| 14 | + node-version: lts/* |
| 15 | + registry-url: 'https://registry.npmjs.org' |
| 16 | + |
| 17 | + - name: Install dependencies |
| 18 | + run: | |
| 19 | + npm install -g pnpm |
| 20 | + pnpm install |
| 21 | +
|
| 22 | + - name: Compile TypeScript |
| 23 | + run: npx tsc |
| 24 | + |
| 25 | + - name: Copy styles to dist |
| 26 | + run: | |
| 27 | + mkdir -p dist/core |
| 28 | + cp -r src/core/styles dist/core/ |
| 29 | +
|
| 30 | + - name: Install e2e dependencies |
| 31 | + run: | |
| 32 | + cd e2e/site |
| 33 | + pnpm install |
| 34 | +
|
| 35 | + - name: Copy local typedcssx |
| 36 | + run: | |
| 37 | + rm -rf e2e/site/node_modules/typedcssx |
| 38 | + mkdir e2e/site/node_modules/typedcssx |
| 39 | + cp -r bin compiler dist next release/package.json e2e/site/node_modules/typedcssx/ |
| 40 | +
|
| 41 | + - name: Create symlink for cssx |
| 42 | + run: | |
| 43 | + mkdir -p e2e/site/node_modules/.bin |
| 44 | + ln -s ../typedcssx/bin/cssx e2e/site/node_modules/.bin/cssx |
| 45 | +
|
| 46 | + - name: Run Jest tests |
| 47 | + run: pnpm exec jest --ci --coverage --reporters=github-actions --reporters=summary |
| 48 | + |
| 49 | + - name: Upload coverage report |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: coverage-report |
| 53 | + path: coverage/ |
| 54 | + |
| 55 | + - name: Install Playwright Browsers |
| 56 | + run: pnpm exec playwright install --with-deps |
| 57 | + |
| 58 | + - name: Start Next.js Dev Server |
| 59 | + run: pnpm run dev:e2e & |
| 60 | + env: |
| 61 | + CI: true |
| 62 | + |
| 63 | + - name: Run Playwright tests |
| 64 | + run: pnpm exec playwright test |
| 65 | + |
| 66 | + - name: Upload Playwright report |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + if: always() |
| 69 | + with: |
| 70 | + name: playwright-report |
| 71 | + path: playwright-report/ |
| 72 | + retention-days: 30 |
| 73 | + |
| 74 | + - name: Publish package |
| 75 | + if: success() |
| 76 | + run: | |
| 77 | + mkdir publish |
| 78 | + cp -r bin compiler dist next license readme.md release/package.json ./publish |
| 79 | + cd publish |
| 80 | + npm publish |
| 81 | + env: |
| 82 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments