rename #69
Workflow file for this run
This file contains 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: Typescript Client | |
on: | |
pull_request: | |
paths: | |
- "clients/ts/**" | |
branches: | |
- canary | |
push: | |
paths: | |
- "clients/ts/.bumpversion.cfg" | |
branches: | |
- canary | |
tags: | |
- "release/ts_client/v*.*.*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
package_json_file: clients/ts/package.json | |
run_install: false | |
# Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: "pnpm" | |
node-version: 18 | |
cache-dependency-path: clients/ts/pnpm-lock.yaml | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
working-directory: clients/ts | |
- name: Build Python Client | |
run: pnpm build | |
working-directory: clients/ts | |
- name: Create artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ts-client | |
path: clients/ts/dist | |
pre-release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/canary' | |
environment: nightly | |
permissions: | |
contents: write | |
id-token: write | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ts-client | |
path: clients/ts/dist | |
- id: hash | |
run: | | |
VERSION=$(cat clients/ts/.bumpversion.cfg | grep "current_version =" | cut -d '=' -f 2 | sed 's/[", ]//g') | |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+$ ]]; then | |
echo "Version ($VERSION) is not a pre-release build" | |
exit 1 | |
fi | |
echo "version=${VERSION%.dev*}" >> $GITHUB_OUTPUT | |
echo "full_version=$VERSION" >> $GITHUB_OUTPUT | |
echo "tarball_hash=$(shasum -a 256 clients/ts/dist/gloo_lib-$VERSION.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
echo "whl_hash=$(shasum -a 256 clients/ts/dist/gloo_lib-$VERSION-py3-none-any.whl | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
- name: Pre-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "unstable/ts_client/v${{ steps.hash.outputs.version }}" | |
files: | | |
clients/ts/dist/gloo_lib-${{ steps.hash.outputs.version }}.tar.gz | |
clients/ts/dist/gloo_lib-${{ steps.hash.outputs.version }}-py3-none-any.whl | |
prerelease: true | |
body: | | |
## Hashes | |
Full Build: ${{ steps.hash.outputs.full_version }} | |
Tarball: ${{ steps.hash.outputs.tarball_hash }} | |
Wheel: ${{ steps.hash.outputs.whl_hash }} | |
- name: Mint token | |
id: mint | |
uses: tschm/[email protected] | |
- name: Install Poetry | |
run: | | |
pipx install poetry | |
- name: Publish the package with poetry | |
run: | | |
poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' | |
working-directory: clients/ts | |
release: | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/release/') | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-client | |
path: clients/ts/dist | |
- id: hash | |
run: | | |
VERSION=$(cat clients/ts/.bumpversion.cfg | grep "current_version =" | cut -d '=' -f 2 | sed 's/[", ]//g') | |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Version ($VERSION) is not a release build" | |
exit 1 | |
fi | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "tarball_hash=$(shasum -a 256 clients/ts/dist/gloo_lib-$VERSION.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
echo "whl_hash=$(shasum -a 256 clients/ts/dist/gloo_lib-$VERSION-py3-none-any.whl | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "release/py_client/v${{ steps.hash.outputs.version }}" | |
files: | | |
clients/ts/dist/gloo_lib-${{ steps.hash.outputs.version }}.tar.gz | |
clients/ts/dist/gloo_lib-${{ steps.hash.outputs.version }}-py3-none-any.whl | |
prerelease: false | |
body: | | |
## Hashes | |
Tarball: ${{ steps.hash.outputs.tarball_hash }} | |
Wheel: ${{ steps.hash.outputs.whl_hash }} | |
- name: Mint token | |
id: mint | |
uses: tschm/[email protected] | |
- name: Install Poetry | |
run: | | |
pipx install poetry | |
- name: Publish the package with poetry | |
run: | | |
poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' | |
working-directory: clients/ts |