|
1 |
| -name: Publish (Released) |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - release: |
5 |
| - types: [released] |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
6 | 7 |
|
7 | 8 | defaults:
|
8 | 9 | run:
|
9 | 10 | shell: bash
|
10 | 11 |
|
11 |
| -permissions: |
12 |
| - contents: write |
13 |
| - |
14 | 12 | jobs:
|
15 |
| - publish: |
| 13 | + changesets: |
16 | 14 | runs-on: ubuntu-latest
|
17 | 15 | permissions:
|
| 16 | + contents: write |
18 | 17 | id-token: write
|
| 18 | + pull-requests: write |
| 19 | + pages: write |
19 | 20 | steps:
|
| 21 | + # Build |
20 | 22 | - uses: actions/checkout@v4
|
21 |
| - |
22 |
| - - name: Verify that tag and package.json match. |
23 |
| - run: | |
24 |
| - TAGGED_VERSION=$(echo "${{ github.ref_name }}" | grep -oP "[0-9]+\.[0-9]+\.[0-9]$") |
25 |
| - PUBLISH_VERSION=$(jq --raw-output .version package.json) |
26 |
| - if [ "$TAGGED_VERSION" != "$PUBLISH_VERSION" ]; then |
27 |
| - exit 1 |
28 |
| - fi |
29 |
| -
|
30 |
| - - name: Build |
31 |
| - uses: oven-sh/setup-bun@v1 |
| 23 | + - uses: oven-sh/setup-bun@v1 |
32 | 24 | - run: bun install
|
33 |
| - - run: bun check:apply |
34 |
| - - run: bun type-check |
| 25 | + - run: bun run lint:fix |
| 26 | + - run: bun run typecheck |
35 | 27 | - run: bun test
|
36 |
| - - run: bun docs |
37 | 28 | - run: bun run build
|
38 | 29 |
|
39 |
| - - name: Publish |
40 |
| - uses: actions/setup-node@v4 |
| 30 | + # Version/publish |
| 31 | + - uses: actions/setup-node@v4 |
41 | 32 | with:
|
42 | 33 | node-version: 20
|
43 |
| - registry-url: "https://registry.npmjs.org" |
44 |
| - - run: npm publish --provenance --access public |
| 34 | + - id: changesets |
| 35 | + uses: changesets/action@v1 |
| 36 | + with: |
| 37 | + title: '[ci] release' |
| 38 | + commit: '[ci] release' |
| 39 | + publish: bun changeset publish |
| 40 | + createGithubReleases: true |
45 | 41 | env:
|
46 |
| - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
47 |
| - |
48 |
| - # - uses: actions/setup-node@v4 |
49 |
| - # with: |
50 |
| - # registry-url: "https://npm.pkg.github.com" |
51 |
| - # - run: npm publish |
52 |
| - # env: |
53 |
| - # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
54 | 44 |
|
55 |
| - - name: Generate docs |
| 45 | + # Docs |
| 46 | + - if: steps.changesets.outputs.published == 'true' |
| 47 | + run: | |
| 48 | + bun install |
| 49 | + bun run build |
| 50 | + working-directory: ./website |
| 51 | + - if: steps.changesets.outputs.published == 'true' |
56 | 52 | uses: actions/upload-pages-artifact@v3
|
57 | 53 | with:
|
58 |
| - path: ./docs |
59 |
| - |
60 |
| - deploy_docs: |
61 |
| - needs: publish |
62 |
| - permissions: |
63 |
| - pages: write |
64 |
| - id-token: write |
65 |
| - environment: |
66 |
| - name: github-pages |
67 |
| - url: ${{ steps.deployment.outputs.page_url }} |
68 |
| - runs-on: ubuntu-latest |
69 |
| - steps: |
70 |
| - - name: Deploy docs to GitHub Pages |
71 |
| - id: deployment |
| 54 | + path: ./website/dist |
| 55 | + - if: steps.changesets.outputs.published == 'true' |
72 | 56 | uses: actions/deploy-pages@v4
|
0 commit comments