Skip to content

fix: type all dto because openapi create object instead of real type … #3

fix: type all dto because openapi create object instead of real type …

fix: type all dto because openapi create object instead of real type … #3

name: Build & Deploy API
on:
push:
branches: ['main']
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
VERSION=$(date +%Y%m%d%H%M%S)
echo "VERSION=$VERSION" >> $GITHUB_ENV
docker build \
-t ghcr.io/${{ github.repository_owner }}/api:$VERSION .
docker tag ghcr.io/${{ github.repository_owner }}/api:$VERSION ghcr.io/${{ github.repository_owner }}/api:latest
- name: Push image
run: |
docker push ghcr.io/${{ github.repository_owner }}/api:$VERSION
docker push ghcr.io/${{ github.repository_owner }}/api:latest
- name: Clone infra repo
run: |
git clone https://ci-bot:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/infra.git
- name: Update api deployment image tag
run: |
cd infra/apps/services/api
sed -i "s|image: ghcr.io.*/api.*|image: ghcr.io/${{ github.repository_owner }}/api:$VERSION|" deployment.yaml
- name: Commit manifest change
run: |
cd infra
git config user.name "ci-bot"
git config user.email "ci-bot@github.com"
git remote set-url origin https://ci-bot:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository_owner }}/infra.git
git add .
git commit -m "deploy: api $VERSION" || echo "No changes to commit"
git push origin main
env:
GIT_AUTHOR_NAME: ci-bot
GIT_AUTHOR_EMAIL: ci-bot@github.com
GIT_COMMITTER_NAME: ci-bot
GIT_COMMITTER_EMAIL: ci-bot@github.com