Publish breadbox client #12
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: Publish breadbox client | |
on: | |
workflow_dispatch: | |
jobs: | |
publish-breadbox-client: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Compute poetry cache dir" | |
id: "poetry-cachedir" | |
run: 'echo POETRY_CACHEDIR="$HOME/.cache/pypoetry" >> "$GITHUB_OUTPUT"' | |
- name: "Check out" | |
uses: actions/checkout@v3 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
fetch-depth: 0 | |
- name: "Authenticate to Google Cloud" | |
uses: google-github-actions/auth@v2 | |
with: | |
# See instructions here: https://github.com/google-github-actions/auth?tab=readme-ov-file#service-account-key-json | |
credentials_json: ${{ secrets.DEPMAP_ARTIFACTS_SVC_ACCT }} | |
- name: "Install and configure Poetry" | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.2 | |
virtualenvs-create: true | |
- name: "Set up poetry cache" | |
uses: actions/cache@v2 | |
id: cached-poetry-dependencies | |
with: | |
path: "${{ steps.poetry-cachedir.outputs.POETRY_CACHEDIR }}" | |
key: "breadbox-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('breadbox*/**/poetry.lock') }}" | |
- name: "Export the OpenAPI spec" | |
working-directory: "./breadbox" | |
run: | | |
poetry install | |
poetry run ./bb export-api-spec ../breadbox-client/latest-breadbox-api.json | |
- name: "Create client from spec" | |
working-directory: "./breadbox-client-generator" | |
run: | | |
poetry install | |
poetry run ./bb export-api-spec ../breadbox-client/latest-breadbox-api.json | |
- name: "peek at poetry cachedir" | |
run: "ls -l ${{ steps.poetry-cachedir.outputs.POETRY_CACHEDIR }}/*" | |
- name: "Set up authentication for publishing breadbox client" | |
working-directory: "./breadbox-client" | |
run: | | |
find ./breadbox_client | |
poetry self add keyrings.google-artifactregistry-auth | |
poetry config repositories.public-python https://us-central1-python.pkg.dev/cds-artifacts/public-python/ | |
- name: "Publish new breadbox client version to Artifact Registry" | |
working-directory: "./breadbox-client" | |
run: | | |
poetry publish --build --repository public-python |