1- name : CI/CD
2-
1+ # file: noinspection SpellCheckingInspection
32on :
43 push :
54 branches : [ "main", "dev" ]
5+ # Publish semver tags as releases.
66 tags : [ 'v*.*.*' ]
77 pull_request :
8- branches : [ "dev" ]
8+ branches : ["dev"]
9+
10+ env :
11+ REGISTRY : ghcr.io
12+ IMAGE_NAME : ${{ github.repository }}
913
1014jobs :
1115 tests :
12- uses : ./.github/workflows/tests.yaml
13-
16+ name : Run tests
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@v4
20+ - name : Setup PDM
21+ uses : pdm-project/setup-pdm@v4
22+ with :
23+ cache : true
24+ - name : Install dependencies
25+ run : pdm install -d
26+ - name : Run linting check
27+ run : pdm run lint --check
28+ - name : Run tests
29+ run : pdm run tests
30+ - name : Export requirements
31+ run : pdm run export
32+ - name : Check for changes
33+ if : contains(github.actor, 'renovate[bot]') == false
34+ run : git diff --exit-code HEAD requirements.txt
1435 docker :
1536 needs : tests
16- uses : ./.github/workflows/docker.yaml
17- secrets : inherit
37+ runs-on : ubuntu-latest
38+ permissions :
39+ contents : read
40+ packages : write
41+ id-token : write
42+ steps :
43+ - name : Checkout repository
44+ uses : actions/checkout@v4
45+
46+ - name : Set up Docker Buildx
47+ uses : docker/setup-buildx-action@v3.4.0
48+
49+ - name : Log into registry ${{ env.REGISTRY }}
50+ uses : docker/login-action@v3.2.0
51+ with :
52+ registry : ${{ env.REGISTRY }}
53+ username : ${{ github.actor }}
54+ password : ${{ secrets.GITHUB_TOKEN }}
55+
56+ - name : Extract Docker metadata for
57+ id : meta
58+ uses : docker/metadata-action@v5.5.1
59+ with :
60+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61+ tags : |
62+ type=ref,event=branch
63+ type=ref,event=pr
64+ type=ref,event=tag
65+ type=sha
66+
67+ - name : Build and push Docker image
68+ uses : docker/build-push-action@v6.3.0
69+ with :
70+ context : .
71+ push : true
72+ tags : ${{ steps.meta.outputs.tags }}
73+ labels : ${{ steps.meta.outputs.labels }}
74+ cache-from : type=gha
75+ cache-to : type=gha,mode=max
0 commit comments