feat: Gitea Actions CI/CD pipeline
This commit is contained in:
55
.gitea/workflows/ci-cd.yml
Normal file
55
.gitea/workflows/ci-cd.yml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
name: CI/CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install ruff mypy -r requirements.txt
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: ruff check .
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: mypy check_versions.py --ignore-missing-imports
|
||||||
|
|
||||||
|
build-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: lint-test
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
docker build -t ${{ secrets.REGISTRY_URL }}/k8s-version-tracker:${{ github.sha }} \
|
||||||
|
-t ${{ secrets.REGISTRY_URL }}/k8s-version-tracker:latest .
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||||
|
docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
|
||||||
|
docker push ${{ secrets.REGISTRY_URL }}/k8s-version-tracker:${{ github.sha }}
|
||||||
|
docker push ${{ secrets.REGISTRY_URL }}/k8s-version-tracker:latest
|
||||||
|
|
||||||
|
- name: Notify Mattermost
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status }}"
|
||||||
|
EMOJI=$([ "$STATUS" = "success" ] && echo ":white_check_mark:" || echo ":x:")
|
||||||
|
curl -s -X POST "${{ secrets.MATTERMOST_WEBHOOK_URL }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"text\": \"$EMOJI k8s-version-tracker build **$STATUS** — \`${{ github.sha }}\`\"}"
|
||||||
Reference in New Issue
Block a user