Skip to content

Commit

Permalink
Fix pipeline (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin PILIA <[email protected]>
  • Loading branch information
benjaminpilia and Benjamin PILIA authored Nov 7, 2024
1 parent 315ee06 commit 6e196f4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/franceservices-backend
IMAGE_TAG: ${{ github.sha }}

# TODO: add tests
# Gitlab old code:
# test:pyalbert:
Expand Down Expand Up @@ -48,13 +52,15 @@ jobs:
build-and-push:
name: Build and push from ${{ github.ref_name }}/${{ github.sha }}
runs-on: ubuntu-latest
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/api
IMAGE_TAG: ${{ github.sha }}
outputs:
commit_title: ${{ steps.get_head_commit_title.outputs.title }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- id: get_head_commit_title
run: echo "title=$(git log --format=%B -n 1 HEAD | head -n 1)" >> $GITHUB_OUTPUT

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -85,9 +91,9 @@ jobs:
RESPONSE="$(curl --request POST \
--form token=${{ secrets.GITLAB_CI_TOKEN }} \
--form ref=main \
--form 'variables[pipeline_name]=${{ github.event.repository.name }} - ${{ github.event.head_commit.message }}' \
--form 'variables[docker_image_tag]=latest' \
--form 'variables[application_to_deploy]=${{ github.event.repository.name }}' \
--form 'variables[pipeline_name]=${{ github.event.repository.name }} - ${{ needs.build-and-push.outputs.commit_title }}' \
--form 'variables[docker_image_tag]=${{ env.IMAGE_TAG }}' \
--form 'variables[application_to_deploy]=albert-france-services-backend' \
--form 'variables[deployment_environment]=dev' \
'https://gitlab.com/api/v4/projects/58117805/trigger/pipeline')"
Expand All @@ -96,4 +102,4 @@ jobs:
else
echo $RESPONSE
exit 1
fi
fi
1 change: 1 addition & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ RUN pip install --no-cache-dir --default-timeout=100 .
# add the rest of the code
ADD . .


CMD ["bash", "start.sh"]
7 changes: 6 additions & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ dependencies = [
"sqlalchemy-utils==0.41.2",
"uvicorn==0.30.1",
"lz4==4.3.3",
"pyalbert==0.7.6",
"pyalbert==0.7.7",
"itsdangerous==2.2.0",
"redis==5.1.1",
"authlib==1.3.2",
"pyjwt==2.9.0",
"faker==30.8.0"
]

# Tests
Expand Down
13 changes: 12 additions & 1 deletion docs/packaging.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
How to build and deploy pyalbert
# Comment build et publier une nouvelle version de PyAAlbert

Le module `pyalbert` est publié dabs les dépôts PyPi. Il faut incrémenter manuellement toute nouvelle version de `pyalbert`.
Pour cela, modifier:
- la variable `__version__` dans `pyalbert/_version.py`
- la variable `version` dans le `pyproject.toml` racine

Puis lancer:
```sh
python -m pip install build twine
python -m build
twine upload dist/*
```


# Mise à jour du module dans l'API
Pour que l'API utilise la nouvelle version du module, modifier la valeur du module `pyalbert==0.x.y` (section `dependencies`) dans le `pyproject.toml` du dossier api.

0 comments on commit 6e196f4

Please sign in to comment.