|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - master |
| 7 | + tags: |
| 8 | + - 'v*.*.*' |
| 9 | + - '*.*.*' |
7 | 10 |
|
8 | 11 | jobs: |
9 | 12 | ci: |
10 | 13 | runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: write |
| 16 | + id-token: write |
11 | 17 | steps: |
12 | 18 | - uses: actions/checkout@v6 |
13 | 19 |
|
|
42 | 48 | - uses: actions/setup-node@v6 |
43 | 49 | with: |
44 | 50 | node-version: 'lts/*' |
| 51 | + registry-url: 'https://registry.npmjs.org' |
45 | 52 |
|
46 | 53 | - name: Install requirements |
47 | 54 | run: npm ci |
@@ -117,3 +124,41 @@ jobs: |
117 | 124 | files: ./coverage/junit.xml |
118 | 125 | disable_search: true |
119 | 126 | verbose: true |
| 127 | + |
| 128 | + - name: Archive build |
| 129 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
| 130 | + run: tar -czvf dist.tar.gz dist/ |
| 131 | + |
| 132 | + - name: Upload Artifacts (Version Tag) |
| 133 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
| 134 | + uses: ncipollo/release-action@v1 |
| 135 | + with: |
| 136 | + artifacts: "dist.tar.gz,bin/cdd-ts.js,bin/cdd-ts.wasm,bin/typescript-go.wasm,bin/cdd-ts-javy.wasm,bin/cdd-ts-go-javy.wasm" |
| 137 | + allowUpdates: true |
| 138 | + replacesArtifacts: true |
| 139 | + |
| 140 | + - name: Update latest tag |
| 141 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 142 | + env: |
| 143 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 144 | + run: | |
| 145 | + gh release delete latest --cleanup-tag -y || true |
| 146 | + git push origin :refs/tags/latest || true |
| 147 | + git tag -f latest ${{ github.sha }} |
| 148 | + git push -f origin latest |
| 149 | +
|
| 150 | + - name: Create Latest Release |
| 151 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 152 | + uses: ncipollo/release-action@v1 |
| 153 | + with: |
| 154 | + tag: latest |
| 155 | + name: Latest Release |
| 156 | + artifacts: "dist.tar.gz,bin/cdd-ts.js,bin/cdd-ts.wasm,bin/typescript-go.wasm,bin/cdd-ts-javy.wasm,bin/cdd-ts-go-javy.wasm" |
| 157 | + allowUpdates: true |
| 158 | + replacesArtifacts: true |
| 159 | + |
| 160 | + - name: Publish to npmjs |
| 161 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 162 | + run: npm publish --provenance --access public |
| 163 | + env: |
| 164 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments