|
1 | | -name: Publish Package to npm |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - main |
10 | | -permissions: write-all |
11 | | - |
12 | | -concurrency: |
13 | | - group: ${{ github.workflow }}-${{ github.ref }} |
14 | | - cancel-in-progress: false |
15 | | - |
16 | | -jobs: |
17 | | - check: |
18 | | - runs-on: ubuntu-latest |
19 | | - steps: |
20 | | - - name: Checkout |
21 | | - uses: actions/checkout@v5 |
22 | | - |
23 | | - - uses: oven-sh/setup-bun@v2 |
24 | | - with: |
25 | | - bun-version: latest |
26 | | - - run: bun i |
27 | | - - run: bun lint |
28 | | - - run: bun run build |
29 | | - - run: bun lint |
30 | | - - run: bun test --coverage |
31 | | - |
32 | | - changepacks: |
33 | | - name: changepacks |
34 | | - runs-on: ubuntu-latest |
35 | | - permissions: |
36 | | - # create pull request comments |
37 | | - pull-requests: write |
38 | | - |
39 | | - # Actions > General > Workflow permissions for creating pull request |
40 | | - # Create brench to create pull request |
41 | | - contents: write |
42 | | - needs: |
43 | | - - check |
44 | | - steps: |
45 | | - - uses: actions/checkout@v5 |
46 | | - - uses: changepacks/action@main |
47 | | - id: changepacks |
48 | | - outputs: |
49 | | - changepacks: ${{ steps.changepacks.outputs.changepacks }} |
50 | | - |
51 | | - publish: |
52 | | - runs-on: ubuntu-latest |
53 | | - needs: |
54 | | - - changepacks |
55 | | - if: contains(needs.changepacks.outputs.changepacks, 'package.json') |
56 | | - steps: |
57 | | - - name: Checkout |
58 | | - uses: actions/checkout@v5 |
59 | | - |
60 | | - - uses: oven-sh/setup-bun@v2 |
61 | | - with: |
62 | | - bun-version: latest |
63 | | - - run: bun i |
64 | | - - run: bun run build |
65 | | - - run: bun test --coverage --coverage-reporter=lcov |
66 | | - - name: Upload to codecov.io |
67 | | - uses: codecov/codecov-action@v5 |
68 | | - with: |
69 | | - token: ${{ secrets.CODECOV_TOKEN }} |
70 | | - fail_ci_if_error: true |
71 | | - files: ./coverage/lcov.info |
72 | | - - run: bunx @changepacks/cli publish --yes |
73 | | - env: |
74 | | - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 1 | +name: Publish Package to npm |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | +permissions: write-all |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: false |
| 15 | + |
| 16 | +jobs: |
| 17 | + check: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v5 |
| 22 | + |
| 23 | + - uses: oven-sh/setup-bun@v2 |
| 24 | + with: |
| 25 | + bun-version: latest |
| 26 | + - run: bun i |
| 27 | + - run: bun lint |
| 28 | + - run: bun run build |
| 29 | + - run: bun lint |
| 30 | + - run: bun test --coverage |
| 31 | + |
| 32 | + changepacks: |
| 33 | + name: changepacks |
| 34 | + runs-on: ubuntu-latest |
| 35 | + permissions: |
| 36 | + # create pull request comments |
| 37 | + pull-requests: write |
| 38 | + |
| 39 | + # Actions > General > Workflow permissions for creating pull request |
| 40 | + # Create brench to create pull request |
| 41 | + contents: write |
| 42 | + needs: |
| 43 | + - check |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v5 |
| 46 | + - uses: changepacks/action@main |
| 47 | + id: changepacks |
| 48 | + outputs: |
| 49 | + changepacks: ${{ steps.changepacks.outputs.changepacks }} |
| 50 | + |
| 51 | + publish: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: |
| 54 | + - changepacks |
| 55 | + if: contains(needs.changepacks.outputs.changepacks, 'package.json') |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v5 |
| 59 | + |
| 60 | + - uses: oven-sh/setup-bun@v2 |
| 61 | + with: |
| 62 | + bun-version: latest |
| 63 | + - run: bun i |
| 64 | + - run: bun run build |
| 65 | + - run: bun test --coverage --coverage-reporter=lcov |
| 66 | + - name: Upload to codecov.io |
| 67 | + uses: codecov/codecov-action@v5 |
| 68 | + with: |
| 69 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 70 | + fail_ci_if_error: true |
| 71 | + files: ./coverage/lcov.info |
| 72 | + - uses: changepacks/action@main |
| 73 | + with: |
| 74 | + publish: true |
| 75 | + env: |
| 76 | + NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments