-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(breadbox): Improvements to breadbox client publishing (#165)
- Loading branch information
Showing
16 changed files
with
114 additions
and
880 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# A re-usable github action which generates the breadbox client | ||
name: "prepare-breadbox-client" | ||
description: "Auto-generate the breadbox client" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Prepare breadbox client | ||
uses: ./.github/actions/prepare-breadbox # checks out and installs poetry | ||
|
||
- name: "Export the OpenAPI spec" | ||
working-directory: "./breadbox" | ||
run: | | ||
poetry install | ||
poetry run ./bb export-api-spec ../breadbox-client/latest-breadbox-api.json | ||
shell: bash | ||
|
||
- name: "Create client from spec" | ||
working-directory: "./breadbox-client-generator" | ||
run: | | ||
poetry install | ||
poetry run ./generate.sh | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# A re-usable github action which does the initial checkout and sets up poetry with caching for breadbox | ||
name: "prepare-breadbox" | ||
description: "Checks out and prepares poetry (with caching)" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Compute poetry cache dir" | ||
id: "poetry-cachedir" | ||
run: 'echo POETRY_CACHEDIR="$HOME/.cache/pypoetry" >> "$GITHUB_OUTPUT"' | ||
shell: bash | ||
|
||
- 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: "peek at poetry cachedir (for debugging)" | ||
# run: "ls -l ${{ steps.poetry-cachedir.outputs.POETRY_CACHEDIR }}/* || true" | ||
# shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "publish-breadbox-client" | ||
description: "Publishes breadbox client to google artifact service" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Set up authentication for publishing breadbox client" | ||
working-directory: "./breadbox-client" | ||
run: | | ||
poetry self add keyrings.google-artifactregistry-auth | ||
poetry config repositories.public-python https://us-central1-python.pkg.dev/cds-artifacts/public-python/ | ||
shell: bash | ||
|
||
- name: "Publish new breadbox client version to Artifact Registry" | ||
working-directory: "./breadbox-client" | ||
run: | | ||
poetry publish --build --repository public-python | ||
shell: bash |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
openapi-python-client \ | ||
generate \ | ||
--meta=none \ | ||
--output-path ../breadbox-client/breadbox_client \ | ||
--path ../breadbox-client/latest-breadbox-api.json \ | ||
--overwrite | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ description = "" | |
authors = ["Your Name <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{include = "breadbox_client_generator"}] | ||
package-mode = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
|
Oops, something went wrong.