|
6 | 6 | # separate terms of service, privacy policy, and support |
7 | 7 | # documentation. |
8 | 8 |
|
9 | | -name: Upload Python Package |
| 9 | +name: Publish Packages |
10 | 10 |
|
11 | 11 | on: |
12 | 12 | push: |
13 | 13 | tags: |
14 | | - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10, v0.1.0.dev1 |
| 14 | + - 'python-v*' # Python releases: python-v1.0.0, python-v1.0.1, etc. |
| 15 | + - 'typescript-v*' # TypeScript releases: typescript-v1.0.0, typescript-v1.0.1, etc. |
15 | 16 |
|
16 | 17 | permissions: |
17 | 18 | contents: read |
18 | 19 |
|
19 | 20 | jobs: |
20 | | - deploy: |
| 21 | + publish-python: |
| 22 | + if: startsWith(github.ref, 'refs/tags/python-v') |
21 | 23 | runs-on: ubuntu-latest |
22 | 24 |
|
23 | 25 | steps: |
|
41 | 43 | - name: Extract version from tag and update pyproject.toml |
42 | 44 | working-directory: ./python |
43 | 45 | run: | |
44 | | - # Get the version from the tag (remove 'v' prefix) |
45 | | - TAG_VERSION=${GITHUB_REF#refs/tags/v} |
| 46 | + # Get the version from the tag (remove 'python-v' prefix) |
| 47 | + TAG_VERSION=${GITHUB_REF#refs/tags/python-v} |
46 | 48 | echo "Tag version: $TAG_VERSION" |
47 | 49 |
|
48 | 50 | # Update pyproject.toml with the version from the tag |
|
70 | 72 | user: __token__ |
71 | 73 | password: ${{ secrets.PYPI_API_TOKEN }} |
72 | 74 | verbose: true |
| 75 | + |
| 76 | + publish-typescript: |
| 77 | + if: startsWith(github.ref, 'refs/tags/typescript-v') |
| 78 | + runs-on: ubuntu-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + with: |
| 83 | + fetch-depth: 0 |
| 84 | + |
| 85 | + - name: Set up Node.js |
| 86 | + uses: actions/setup-node@v4 |
| 87 | + with: |
| 88 | + node-version: '18' |
| 89 | + registry-url: 'https://registry.npmjs.org' |
| 90 | + |
| 91 | + - name: Install dependencies |
| 92 | + working-directory: ./typescript |
| 93 | + run: npm ci |
| 94 | + |
| 95 | + - name: Extract version from tag and update package.json |
| 96 | + working-directory: ./typescript |
| 97 | + run: | |
| 98 | + # Get the version from the tag (remove 'typescript-v' prefix) |
| 99 | + TAG_VERSION=${GITHUB_REF#refs/tags/typescript-v} |
| 100 | + echo "Tag version: $TAG_VERSION" |
| 101 | +
|
| 102 | + # Update package.json with the version from the tag |
| 103 | + npm version $TAG_VERSION --no-git-tag-version |
| 104 | + echo "Version updated in package.json to: $TAG_VERSION" |
| 105 | +
|
| 106 | + # Verify the change |
| 107 | + cat package.json | grep '"version"' |
| 108 | +
|
| 109 | + - name: Generate types and build package |
| 110 | + working-directory: ./typescript |
| 111 | + run: | |
| 112 | + npm run generate-types |
| 113 | + npm run build |
| 114 | +
|
| 115 | + - name: Run tests |
| 116 | + working-directory: ./typescript |
| 117 | + run: npm test |
| 118 | + |
| 119 | + - name: Publish package to NPM |
| 120 | + working-directory: ./typescript |
| 121 | + run: npm publish |
| 122 | + env: |
| 123 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments