Update readmes to be inline with package contents #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will build and test the TypeScript library | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: TypeScript | |
| on: | |
| workflow_dispatch: # Manual trigger | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| # Permissions for npmjs trusted publishing | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version from git tag | |
| id: version | |
| run: | | |
| VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.1-preview") | |
| VERSION=${VERSION#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: src/Typescript/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: src/Typescript | |
| - name: Set package version | |
| run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version | |
| working-directory: src/Typescript | |
| - name: Build | |
| run: npm run build | |
| working-directory: src/Typescript | |
| - name: Test | |
| run: npm test | |
| working-directory: src/Typescript | |
| - name: Pack npm package | |
| run: npm pack | |
| working-directory: src/Typescript | |
| - name: Upload npm package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-package | |
| path: src/Typescript/*.tgz | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| environment: npm-production | |
| steps: | |
| - name: Download npm package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: npm-package | |
| path: ./package | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Publish to npm | |
| run: npm publish ./package/*.tgz --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |