Bump SDK packages to 0.1.2 (#20) #23
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
| name: Publish SDKs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| npm: | |
| name: Publish npm package | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: sdk/typescript | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| package-manager-cache: false | |
| - run: npm ci | |
| - run: npm run build | |
| - id: package | |
| run: | | |
| name=$(node -p "require('./package.json').name") | |
| version=$(node -p "require('./package.json').version") | |
| echo "name=$name" >> "$GITHUB_OUTPUT" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| if npm view "$name@$version" version >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - if: steps.package.outputs.exists == 'false' | |
| run: npm publish --access public | |
| - if: steps.package.outputs.exists == 'true' | |
| run: echo "${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }} is already published; skipping npm publish." | |
| pypi: | |
| name: Publish PyPI package | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/mv37-workdir | |
| defaults: | |
| run: | |
| working-directory: sdk/python | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - run: python -m pip install build | |
| - id: package | |
| run: | | |
| python - <<'PY' >> "$GITHUB_OUTPUT" | |
| import tomllib | |
| import urllib.error | |
| import urllib.request | |
| with open("pyproject.toml", "rb") as f: | |
| project = tomllib.load(f)["project"] | |
| name = project["name"] | |
| version = project["version"] | |
| print(f"name={name}") | |
| print(f"version={version}") | |
| url = f"https://pypi.org/pypi/{name}/{version}/json" | |
| try: | |
| urllib.request.urlopen(url, timeout=10) | |
| except urllib.error.HTTPError as error: | |
| if error.code == 404: | |
| print("exists=false") | |
| else: | |
| raise | |
| else: | |
| print("exists=true") | |
| PY | |
| - if: steps.package.outputs.exists == 'false' | |
| run: python -m build | |
| - if: steps.package.outputs.exists == 'false' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: sdk/python/dist | |
| - if: steps.package.outputs.exists == 'true' | |
| run: echo "${{ steps.package.outputs.name }} ${{ steps.package.outputs.version }} is already published; skipping PyPI publish." |