ci: ajout workflow build & deploy Gitea Actions
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
name: Build & Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.lan
|
||||
IMAGE: gitea.lan/shaz/le-site-de-ma-mamounette
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login au registry Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build & push image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.IMAGE }}:latest
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-push
|
||||
|
||||
steps:
|
||||
- name: Pull nouvelle image & redémarrer
|
||||
run: |
|
||||
docker pull ${{ env.IMAGE }}:latest
|
||||
docker compose -f /srv/ssd/stacks/moulin/docker-compose.yml up -d --pull always
|
||||
Reference in New Issue
Block a user