Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit eb701d8

Browse files
author
Jozef Volak
committed
[github-actions] Create utils release workflow
1 parent d3aff54 commit eb701d8

File tree

6 files changed

+56
-20
lines changed

6 files changed

+56
-20
lines changed

.github/workflows/pr-create.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
IMAGE: ${{ inputs.image }}
2222

2323
- name: Validate input
24-
run: |
24+
run: |
2525
echo ${IMAGE_NAMESPACE}
2626
if [[ "${IMAGE_NAMESPACE}" != "frinx" ]]; then
2727
echo "Only images from frinx namespace can be used!"
@@ -51,8 +51,7 @@ jobs:
5151
with:
5252
python-version: "3.10"
5353

54-
- name: Run image
55-
uses: abatilo/actions-poetry@v2
54+
- uses: abatilo/actions-poetry@v2
5655
with:
5756
poetry-version: "1.4.2"
5857

@@ -127,8 +126,8 @@ jobs:
127126
if: ${{ always() }}
128127
uses: actions/[email protected]
129128
with:
130-
name: ${{ github.workflow }}_logs.zip
131-
path: |
132-
${{ github.workspace }}/logs/
133-
if-no-files-found: error
134-
retention-days: 1
129+
name: ${{ github.workflow }}_logs.zip
130+
path: |
131+
${{ github.workspace }}/logs/
132+
if-no-files-found: error
133+
retention-days: 1

.github/workflows/release_utils.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,50 @@ on:
77
type: choice
88
description: Release package from utils
99
options:
10-
- graphql-pydantic-converter
10+
- utils/graphql-pydantic-converter
1111

1212
jobs:
1313
build:
14+
name: Validate api packages
1415
runs-on: ubuntu-latest
15-
16+
timeout-minutes: 5
17+
defaults:
18+
run:
19+
working-directory: ${{ inputs.utils }}
1620
steps:
1721
- uses: actions/checkout@v2
22+
- uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.10"
25+
- uses: abatilo/actions-poetry@v2
26+
with:
27+
poetry-version: "1.4.2"
28+
- name: Package naming
29+
run: |
30+
echo "PACKAGE_NAME=$(poetry version --no-interaction | cut -d ' ' -f 1)" >> "$GITHUB_ENV"
31+
echo "PACKAGE_VERSION=$(poetry version --no-interaction --short)" >> "$GITHUB_ENV"
32+
echo "RELEASE_TAG=$(poetry version --no-interaction | sed 's| |_v|g')" >> "$GITHUB_ENV"
1833
19-
- name: greet
20-
run: |
21-
echo "choice is ${{ github.event.inputs.choice }}" / ${{ inputs.choice }}
34+
- name: Docker image naming
35+
run: |
36+
echo "IMAGE_NAME=frinx/${{ env.PACKAGE_NAME }}:${{ env.PACKAGE_VERSION }}" >> "$GITHUB_ENV"
37+
- name: Poetry publish
38+
run: poetry publish -u "__token__" -p "${{ secrets.PYPI_TOKEN }}" --build --dry-run
39+
- name: Build docker image
40+
run: docker build . --file Dockerfile --build-arg git_commit=$(git rev-parse HEAD) --tag ${{ env.IMAGE_NAME }}
41+
- name: Log into docker hub
42+
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
43+
- name: Push docker image
44+
run: docker push ${{ env.IMAGE_NAME }}
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@latest
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
tag_name: ${{ env.RELEASE_TAG }}
52+
release_name: Release ${{ env.RELEASE_TAG }}
53+
body: |
54+
- Release of ${{ env.PACKAGE_NAME }}:${{ env.PACKAGE_VERSION }} for image with tag ${{ env.IMAGE_NAME }}
55+
draft: false
56+
prerelease: false

utils/graphql-pydantic-converter/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ RUN poetry build
1414

1515
FROM python:3.10-buster
1616

17-
LABEL maintainer="Jozef Volak <[email protected]>"
17+
LABEL maintainer="Jozef Volak <[email protected]>"
18+
ARG git_commit=unspecified
19+
LABEL git_commit="${git_commit}"
1820

1921
COPY --from=build /home/app/dist/ /home/app
2022

utils/graphql-pydantic-converter/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# GraphQL to Pydantic Transformer & Pydantic to Query Builder
1+
# GraphQL to Pydantic Converter & Pydantic to Query Builder
22

33
## Overview
44

5-
The **GraphQL to Pydantic Transformer** is a Python package designed to simplify the process of transforming GraphQL
5+
The **GraphQL to Pydantic Converter** is a Python package designed to simplify the process of transforming GraphQL
66
schemas in JSON format into Pydantic models. This tool is particularly useful for developers working with GraphQL
77
APIs who want to generate Pydantic models from GraphQL types for efficient data validation
88
and serialization/deserialization.
@@ -18,7 +18,7 @@ and serialization/deserialization.
1818
You can install the **GraphQL to Pydantic Transformer** package via pip:
1919

2020
```bash
21-
pip install graphql-pydantic-transformer
21+
pip install graphql-pydantic-converter
2222
# or
2323
poetry add git+https://github.com/FRINXio/frinx-services-python-api.git@main#subdirectory=utils/graphql-pydantic-converter
2424
```

utils/graphql-pydantic-converter/graphql_pydantic_converter/schema_converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ def __create_specific_response(self, payload: Type) -> None:
461461

462462
if field.args:
463463
self.__result += self.__class_template.substitute(
464-
name=f'{field.name[0].upper() + field.name[1:]}Response',
464+
name=f'{field.name[0].upper() + field.name[1:] + payload.name}Response',
465465
type='BaseModel',
466466
)
467467

468468
self.__refs += self.__refs_template.substitute(
469-
class_name=f'{field.name[0].upper() + field.name[1:]}Response'
469+
class_name=f'{field.name[0].upper() + field.name[1:] + payload.name}Response'
470470
)
471471

472472
self.__result += kv_template.substitute(

utils/graphql-pydantic-converter/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pytest = "^7.4.1"
1616

1717
[tool.poetry]
1818
packages = [{ include = "graphql_pydantic_converter" }]
19-
name = "graphql-pydantic-transformer"
19+
name = "graphql-pydantic-converter"
2020
description = "Convert pydantic schema to pydantic datamodel and build request from it"
2121
authors = ["Jozef Volak <[email protected]>"]
2222
version = '0.1.0'

0 commit comments

Comments
 (0)