@@ -11,21 +11,22 @@ name: CD
1111on :
1212 release :
1313 types : [published]
14-
14+
1515 workflow_dispatch :
1616
1717permissions :
1818 contents : read
19+ packages : write
1920
2021jobs :
2122 deploy :
22-
23+ name : Publish to PyPI
2324 runs-on : ubuntu-latest
2425
2526 steps :
26- - uses : actions/checkout@v3
27+ - uses : actions/checkout@v4
2728 - name : Set up Python
28- uses : actions/setup-python@v3
29+ uses : actions/setup-python@v5
2930 with :
3031 python-version : ' 3.x'
3132 - name : Install dependencies
3940 with :
4041 user : __token__
4142 password : ${{ secrets.PYPI_API_TOKEN }}
43+
44+ docker :
45+ name : Build & Push Docker Image
46+ runs-on : ubuntu-latest
47+
48+ steps :
49+ - name : Checkout code
50+ uses : actions/checkout@v4
51+
52+ - name : Log in to GitHub Container Registry
53+ uses : docker/login-action@v3
54+ with :
55+ registry : ghcr.io
56+ username : ${{ github.actor }}
57+ password : ${{ github.token }}
58+
59+ - name : Extract metadata for Docker
60+ id : meta
61+ uses : docker/metadata-action@v5
62+ with :
63+ images : ghcr.io/${{ github.repository }}
64+ tags : |
65+ type=semver,pattern={{version}}
66+ type=raw,value=latest
67+
68+ - name : Build and push Docker image
69+ uses : docker/build-push-action@v6
70+ with :
71+ context : .
72+ file : docker/Dockerfile
73+ push : true
74+ tags : ${{ steps.meta.outputs.tags }}
75+ labels : ${{ steps.meta.outputs.labels }}
76+
77+ # TODO: To enable Docker Hub publishing, add DOCKERHUB_USERNAME and DOCKERHUB_TOKEN
78+ # as repository secrets.
79+ docker-hub :
80+ name : Push to Docker Hub
81+ runs-on : ubuntu-latest
82+ if : ${{ secrets.DOCKERHUB_USERNAME != '' }}
83+
84+ steps :
85+ - name : Checkout code
86+ uses : actions/checkout@v4
87+
88+ - name : Log in to Docker Hub
89+ uses : docker/login-action@v3
90+ with :
91+ username : ${{ secrets.DOCKERHUB_USERNAME }}
92+ password : ${{ secrets.DOCKERHUB_TOKEN }}
93+
94+ - name : Extract metadata for Docker
95+ id : meta
96+ uses : docker/metadata-action@v5
97+ with :
98+ images : ${{ secrets.DOCKERHUB_USERNAME }}/ftio
99+ tags : |
100+ type=semver,pattern={{version}}
101+ type=raw,value=latest
102+
103+ - name : Build and push Docker image
104+ uses : docker/build-push-action@v6
105+ with :
106+ context : .
107+ file : docker/Dockerfile
108+ push : true
109+ tags : ${{ steps.meta.outputs.tags }}
110+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments