fix: clean .env.template #1
This file contains hidden or 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: 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 |