46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Convert repository name to lowercase
|
|
run: echo "repo_name=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.blyzer.com.br
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push backend image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ./backend
|
|
push: true
|
|
tags: gitea.blyzer.com.br/${{ env.repo_name }}-backend:latest
|
|
|
|
- name: Build and push frontend image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: gitea.blyzer.com.br/${{ env.repo_name }}-frontend:latest
|
|
|
|
- name: Deploy to Portainer
|
|
run: |
|
|
if [ -n "${{ secrets.PORTAINER_WEBHOOK }}" ]; then
|
|
curl -k -X POST "${{ secrets.PORTAINER_WEBHOOK }}"
|
|
else
|
|
echo "PORTAINER_WEBHOOK secret not set, skipping deployment trigger."
|
|
fi
|