Switch from docker buildx CLI to docker/build-push-action@v5 with oci-mediatypes=true to push OCI-format manifests that Zot accepts. Also type-check all three Python files in CI.
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
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 request_upgrades.py web.py
|
|
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
needs: lint-test
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
provenance: false
|
|
sbom: false
|
|
outputs: type=image,push=true,oci-mediatypes=true
|
|
tags: |
|
|
${{ secrets.REGISTRY_URL }}/k8s-version-tracker:${{ github.sha }}
|
|
${{ 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 }}\`\"}"
|