|
1 |
| -name: CI |
| 1 | +name: Pipeline |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
|
10 | 10 | Build:
|
11 | 11 | name: Build
|
12 | 12 | runs-on: ubuntu-latest
|
| 13 | + outputs: |
| 14 | + GitVersion_SemVer: ${{ steps.GitVersion.outputs.GitVersion_SemVer }} |
13 | 15 | steps:
|
14 | 16 | - name: Checkout
|
15 | 17 | uses: actions/checkout@v4
|
| 18 | + with: |
| 19 | + fetch-depth: 0 # Full depth (not shallow) for GitVersion and better relevancy of Sonar analysis |
| 20 | + |
| 21 | + - name: Set up GitVersion |
| 22 | + uses: gittools/actions/gitversion/[email protected] |
| 23 | + with: |
| 24 | + versionSpec: 6.x |
| 25 | + |
| 26 | + - name: Execute GitVersion |
| 27 | + id: GitVersion |
| 28 | + uses: gittools/actions/gitversion/[email protected] |
| 29 | + with: |
| 30 | + useConfigFile: true |
16 | 31 |
|
17 | 32 | - name: Use Node.js
|
18 | 33 | uses: actions/setup-node@v4
|
@@ -54,10 +69,10 @@ jobs:
|
54 | 69 | cache: npm
|
55 | 70 | node-version: ${{ matrix.node }}
|
56 | 71 |
|
57 |
| - - name: Install production |
58 |
| - run: npm ci --include prod |
| 72 | + - name: Install |
| 73 | + run: npm install --omit=dev |
59 | 74 |
|
60 |
| - - name: Build production |
| 75 | + - name: Build |
61 | 76 | run: npm run build
|
62 | 77 |
|
63 | 78 | - name: Run css-typed (the test)
|
|
71 | 86 |
|
72 | 87 | node dist/main.js "$RUNNER_TEMP/*.css" --dashes
|
73 | 88 | diff --strip-trailing-cr -uI '//.*' src/fixtures/kebab-case/kebab-case-dashes.d.css.ts "$RUNNER_TEMP/kebab-case.d.css.ts"
|
| 89 | +
|
| 90 | + Publish: |
| 91 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 92 | + name: Publish |
| 93 | + needs: |
| 94 | + - Build # For version variable |
| 95 | + - Test # Requires passing tests |
| 96 | + runs-on: ubuntu-latest |
| 97 | + env: |
| 98 | + GitVersion_SemVer: ${{needs.Build.outputs.GitVersion_SemVer}} |
| 99 | + permissions: |
| 100 | + contents: write |
| 101 | + id-token: write |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - uses: actions/setup-node@v4 |
| 106 | + with: |
| 107 | + cache: npm |
| 108 | + node-version-file: .node-version |
| 109 | + registry-url: https://registry.npmjs.org |
| 110 | + |
| 111 | + - name: Set version |
| 112 | + run: sed -i 's/0.0.0-gitversion/${{ env.GitVersion_SemVer }}/g' package.json |
| 113 | + |
| 114 | + - name: Install |
| 115 | + run: npm install --omit=dev |
| 116 | + |
| 117 | + - name: Publish |
| 118 | + run: npm publish --provenance --access public |
| 119 | + env: |
| 120 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 121 | + |
| 122 | + - name: git tag |
| 123 | + run: | |
| 124 | + git tag v${{ env.GitVersion_SemVer }} |
| 125 | + git push origin tag v${{ env.GitVersion_SemVer }} |
0 commit comments