1- # This workflow will publish our package on pypi
2-
31name : Publish
42
53on :
64 push :
75 tags :
86 - " v*.*.*"
97
10- env :
11- UV_VERSION : " 0.8.22"
12-
138jobs :
14- build_and_test_package :
15- name : Build and test package
16- runs-on : ubuntu-latest
17-
18- permissions :
19- contents : read
20-
21- steps :
22- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23-
24- - name : Build and test package
25- id : build-test
26- uses : ./.github/actions/python-package-build
27- with :
28- test-package : " true"
29- publish : " false"
30- uv-version : ${{ env.UV_VERSION }}
31- cli-test-command : " twyn --version"
32- python-version : " 3.10"
33-
34- - name : Upload package artifacts
35- uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
36- with :
37- name : python-package-${{ github.sha }}
38- path : ${{ steps.build-test.outputs.dist-path }}
39- retention-days : 1
40-
41- build_and_test_docker :
42- name : Build and test Docker image (${{ matrix.arch }})
43- runs-on : ubuntu-latest
44- permissions :
45- contents : read
46- packages : write
47- strategy :
48- matrix :
49- include :
50- - arch : amd64
51- platform : linux/amd64
52- cache-ref : buildcache-amd64
53- needs-qemu : false
54- - arch : arm64
55- platform : linux/arm64
56- cache-ref : buildcache-arm64
57- needs-qemu : true
58- steps :
59- - name : Check out the repo
60- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
61-
62- - name : Log in to GitHub Container Registry
63- uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
64- with :
65- registry : ghcr.io
66- username : ${{ github.actor }}
67- password : ${{ secrets.GITHUB_TOKEN }}
68-
69- - name : Build Docker image (${{ matrix.arch }})
70- uses : ./.github/actions/docker-build
71- with :
72- push : false
73- load : true
74- platforms : ${{ matrix.platform }}
75- dockerfile : ./Dockerfile
76- context : .
77- image-name : elementsinteractive/twyn
78- cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:${{ matrix.cache-ref }}
79- cache-to : type=registry,ref=ghcr.io/elementsinteractive/twyn:${{ matrix.cache-ref }},mode=max,compression=zstd,force-compression=true,oci-mediatypes=true
80- setup-qemu : ${{ matrix.needs-qemu }}
81-
82- - name : Test Docker image (${{ matrix.arch }})
83- run : |
84- docker run --platform ${{ matrix.platform }} --rm elementsinteractive/twyn --version
85-
869 publish_to_pypi :
8710 name : Publish to PyPI
8811 runs-on : ubuntu-latest
89- needs : [build_and_test_package, build_and_test_docker]
9012
9113 permissions :
9214 id-token : write
@@ -95,16 +17,12 @@ jobs:
9517 steps :
9618 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9719
98- - name : Download package artifacts
99- uses : actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
100- with :
101- name : python-package-${{ github.sha }}
102- path : dist
103-
104- - name : Install uv
105- uses : astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
20+ - name : Build package
21+ uses : ./.github/actions/python-package-build
22+ id : build
10623 with :
107- version : ${{ env.UV_VERSION }}
24+ uv-version : " 0.8.22"
25+ python-version : " 3.10"
10826
10927 - name : Publish package
11028 run : |
11331 publish_to_dockerhub :
11432 name : Push Docker images to registries
11533 runs-on : ubuntu-latest
116- needs : [build_and_test_docker, build_and_test_package]
11734 permissions :
11835 contents : read
11936 packages : write
0 commit comments