Files
fichajes/.gitea/workflows/deploy.yaml
Antoni Nuñez Romeu 40411bb179
Some checks failed
Build and Deploy / login (push) Failing after 15s
Build and Deploy / build-and-deploy (push) Has been cancelled
Fix workflow
2026-04-17 15:46:21 +02:00

52 lines
1.1 KiB
YAML

name: Build and Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
login:
runs-on: ubuntu-latest
steps:
- name: Login to Registry (scoped)
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
scope: 'hacecalor/fichajes@push'
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build Docker image
run: docker build -t my-app .
- name: Tag Docker image
run: docker tag my-app my-registry/my-app:${{ github.run_number }}
- name: Push Docker image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: hacecalor/fichajes:${{ github.run_number }}
- name: Connect to remote host
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
password: ${{ secrets.REMOTE_PASSWORD }}
- name: Pull and run docker compose
run: |
docker pull
docker-compose up -d