|
31 | 31 | with: |
32 | 32 | node-version: '24' |
33 | 33 |
|
34 | | - - name: Run TypeScript package tests |
35 | | - run: npm --prefix packages/ts test |
| 34 | + - name: Validate TypeScript package |
| 35 | + run: | |
| 36 | + npm --prefix packages/ts ci |
| 37 | + npm --prefix packages/ts test |
| 38 | + npm --prefix packages/ts run build |
36 | 39 |
|
37 | 40 | - name: Set up Python |
38 | 41 | uses: actions/setup-python@v5 |
@@ -119,6 +122,62 @@ jobs: |
119 | 122 | gh release create "${TAG_NAME}" dist/* --title "${TAG_NAME}" --notes "Release ${TAG_NAME}" |
120 | 123 | fi |
121 | 124 |
|
| 125 | + npm-package: |
| 126 | + name: Publish TypeScript package |
| 127 | + runs-on: ubuntu-latest |
| 128 | + needs: release |
| 129 | + |
| 130 | + steps: |
| 131 | + - name: Check out repository |
| 132 | + uses: actions/checkout@v4 |
| 133 | + |
| 134 | + - name: Set up Node.js for GitHub Packages |
| 135 | + uses: actions/setup-node@v4 |
| 136 | + with: |
| 137 | + node-version: '24' |
| 138 | + registry-url: https://npm.pkg.github.com |
| 139 | + scope: '@terion-name' |
| 140 | + cache: npm |
| 141 | + cache-dependency-path: packages/ts/package-lock.json |
| 142 | + |
| 143 | + - name: Install TypeScript package dependencies |
| 144 | + run: npm --prefix packages/ts ci |
| 145 | + |
| 146 | + - name: Test and build TypeScript package |
| 147 | + run: | |
| 148 | + npm --prefix packages/ts test |
| 149 | + npm --prefix packages/ts run build |
| 150 | +
|
| 151 | + - name: Check whether npm package version already exists |
| 152 | + id: npm_version |
| 153 | + working-directory: packages/ts |
| 154 | + env: |
| 155 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 156 | + TAG_NAME: ${{ github.ref_name }} |
| 157 | + run: | |
| 158 | + set -euo pipefail |
| 159 | + package_name="$(node -p "require('./package.json').name")" |
| 160 | + if npm view "${package_name}@${TAG_NAME}" version --registry=https://npm.pkg.github.com >/dev/null 2>&1; then |
| 161 | + echo "exists=true" >> "${GITHUB_OUTPUT}" |
| 162 | + echo "${package_name}@${TAG_NAME} already exists; skipping publish." |
| 163 | + else |
| 164 | + echo "exists=false" >> "${GITHUB_OUTPUT}" |
| 165 | + fi |
| 166 | +
|
| 167 | + - name: Set TypeScript package version from tag |
| 168 | + if: steps.npm_version.outputs.exists != 'true' |
| 169 | + working-directory: packages/ts |
| 170 | + env: |
| 171 | + TAG_NAME: ${{ github.ref_name }} |
| 172 | + run: npm version "${TAG_NAME}" --no-git-tag-version |
| 173 | + |
| 174 | + - name: Publish TypeScript package to GitHub Packages |
| 175 | + if: steps.npm_version.outputs.exists != 'true' |
| 176 | + working-directory: packages/ts |
| 177 | + env: |
| 178 | + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 179 | + run: npm publish |
| 180 | + |
122 | 181 | docker-images: |
123 | 182 | name: Build and publish ${{ matrix.app }} image |
124 | 183 | runs-on: ubuntu-latest |
|
0 commit comments