All checks were successful
Build and push / post-finish-message (push) Has been skipped
Build and push / detect-changed-files (push) Successful in 4s
Build and push / Lint-Python (push) Has been skipped
Build and push / post-startup-message (push) Successful in 6s
Build and push / Build-and-Push-Docker (push) Has been skipped
Build and push / sync-argocd-app (push) Has been skipped
99 lines
3.3 KiB
YAML
Executable File
99 lines
3.3 KiB
YAML
Executable File
name: Build and push
|
|
run-name: ${{ gitea.actor }} Triggered a new run 🚀
|
|
on: [push]
|
|
|
|
jobs:
|
|
post-startup-message:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: sarisia/actions-status-discord@v1
|
|
if: always()
|
|
with:
|
|
title: "Pipeline is starting 🚀"
|
|
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
avatar_url: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTP3ekDW_jiUIEmAym337xeS7WN-k_DUq8YHi6VVfwQQw&s"
|
|
detect-changed-files:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
python_files: ${{ steps.filter.outputs.python_files }}
|
|
helm_files: ${{ steps.filter.outputs.helm }}
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
python_files:
|
|
- 'app/**'
|
|
helm:
|
|
- 'helm/**'
|
|
Lint-Python:
|
|
runs-on: ubuntu-latest
|
|
needs: detect-changed-files
|
|
if: ${{ needs.detect-changed-files.outputs.python_files == 'true' }}
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
python_files:
|
|
- 'app/**/*.py'
|
|
- name: install UV
|
|
run: |
|
|
pip install uv --quiet
|
|
if: steps.filter.outputs.python_files == 'true'
|
|
- name: install black and lint code
|
|
run: |
|
|
uv pip install black --system --quiet
|
|
black app --check --fast
|
|
if: steps.filter.outputs.python_files == 'true'
|
|
|
|
Build-and-Push-Docker:
|
|
needs: detect-changed-files
|
|
if: ${{ (needs.detect-changed-files.outputs.python_files == 'true') && (steps.Lint-Python.outcome == 'success') }}
|
|
steps:
|
|
- name: Login to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build and push
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
ldooks/dragon-bot:latest
|
|
ldooks/dragon-bot:${{ gitea.run_id }}
|
|
|
|
sync-argocd-app:
|
|
needs: [detect-changed-files, Build-and-Push-Docker]
|
|
if: ${{ (needs.detect-changed-files.outputs.python_files == 'true') && (steps.Build-and-Push-Docker.outcome == 'success') }}
|
|
steps:
|
|
- name: Sync app in ArgoCD
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 2.6.7
|
|
command: app
|
|
options: --insecure --server 192.168.1.205 --auth-token ${{ secrets.ARGOCD_TOKEN }} set dragon-bot --helm-set image.tag=${{ gitea.run_id }}
|
|
|
|
post-finish-message:
|
|
runs-on: ubuntu-latest
|
|
if: ${{ (steps.Build-and-Push-Docker.outcome == 'success') }}
|
|
steps:
|
|
- uses: sarisia/actions-status-discord@v1
|
|
if: always()
|
|
with:
|
|
title: "Pipeline has completed successfully"
|
|
status:
|
|
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
|
avatar_url: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTP3ekDW_jiUIEmAym337xeS7WN-k_DUq8YHi6VVfwQQw&s" |