71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
name: pipeline
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
|
|
permissions:
|
|
packages: write
|
|
|
|
jobs:
|
|
build-and-push-images:
|
|
runs-on: debian-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: https://git.vhaudiquet.fr
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
|
|
|
- name: Build and push frontend docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./frontend
|
|
push: true
|
|
tags: |
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-frontend:latest
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-frontend:${{ github.sha }}
|
|
|
|
- name: Build and push patch_detector docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./patch_detector
|
|
push: true
|
|
tags: |
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-patch_detector:latest
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-patch_detector:${{ github.sha }}
|
|
|
|
- name: Build and push match_collector docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./match_collector
|
|
push: true
|
|
tags: |
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-match_collector:latest
|
|
git.vhaudiquet.fr/vhaudiquet/lolstats-match_collector:${{ github.sha }}
|
|
deploy:
|
|
runs-on: debian-latest
|
|
needs:
|
|
- build-and-push-images
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create env file
|
|
run: |
|
|
echo "GIT_COMMIT_HASH=${{ github.sha }}" >> .env
|
|
ls -la
|
|
|
|
- name: Docker Stack deploy
|
|
uses: cssnr/stack-deploy-action@v1
|
|
with:
|
|
name: lolstats
|
|
file: docker-compose.yml
|
|
host: 192.168.1.105
|
|
user: root
|
|
ssh_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
|
|
env_file: .env |