diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..99d568b --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,45 @@ +name: ci + +on: + push: + branches: + - main + +jobs: + docker_image: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Install Docker + run: curl -fsSL https://get.docker.com | sh + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.marinodev.com + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + push: true + tags: git.marinodev.com/marinodev/fbla26_ci:latest + no-cache: true + + deploy: + runs-on: ubuntu-latest + needs: docker_image + steps: + - name: Restart Service + uses: https://github.com/appleboy/ssh-action@v1.0.3 + with: + host: ${{ vars.DEPLOY_HOST }} + username: ${{ vars.DEPLOY_USER }} + password: ${{ secrets.DEPLOY_PASSWORD }} + script: | + cd ${{ vars.DEPLOY_PATH }} + git pull + docker-compose down && docker-compose pull && docker-compose up -d \ No newline at end of file