1
- name : CI/CD
2
-
1
+ # file: noinspection SpellCheckingInspection
3
2
on :
4
3
push :
5
4
branches : [ "main", "dev" ]
5
+ # Publish semver tags as releases.
6
6
tags : [ 'v*.*.*' ]
7
7
pull_request :
8
- branches : [ "dev" ]
8
+ branches : ["dev"]
9
+
10
+ env :
11
+ REGISTRY : ghcr.io
12
+ IMAGE_NAME : ${{ github.repository }}
9
13
10
14
jobs :
11
15
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
14
35
docker :
15
36
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
+
48
+
49
+ - name : Log into registry ${{ env.REGISTRY }}
50
+
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
+
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
+
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