11name : Publish
22
3- on :
4- release :
5- types : [published]
3+ on : push
4+
5+ env :
6+ # Use docker.io for Docker Hub if empty
7+ REGISTRY : ghcr.io
8+ # github.repository as <account>/<repo>
9+ IMAGE_NAME : ${{ github.repository }}
610
711jobs :
8- push_to_registries :
9- name : Push Docker image to GHCR
10- runs-on : ubuntu-latest
11- permissions :
12- packages : write
13- contents : read
14- steps :
15- - name : Check out the repo
16- uses : actions/checkout@v4
17-
18- - name : Run tests
19- run : bash test.sh
20-
21- - name : Log in to the Container registry
22- uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23- with :
24- registry : ghcr.io
25- username : ${{ github.actor }}
26- password : ${{ secrets.GITHUB_TOKEN }}
27-
28- - name : Extract metadata (tags, labels) for Docker
29- id : meta
30- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
31- with :
32- images : |
33- getodk/pyxform-http
34- ghcr.io/${{ github.repository }}
35-
36- - name : Build and push Docker image
37- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
38- with :
39- context : .
40- push : true
41- tags : ${{ steps.meta.outputs.tags }}
42- labels : ${{ steps.meta.outputs.labels }}
12+ build :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : read
16+ packages : write
17+
18+ steps :
19+ - name : Checkout repository
20+ uses : actions/checkout@v2
21+
22+ # Login against a Docker registry
23+ # https://github.com/docker/login-action
24+ - name : Log into registry ${{ env.REGISTRY }}
25+ uses : docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
26+ with :
27+ registry : ${{ env.REGISTRY }}
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ # Extract metadata (tags, labels) for Docker
32+ # https://github.com/docker/metadata-action
33+ - name : Extract Docker metadata
34+ id : meta
35+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
36+ with :
37+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
39+ # Build and push Docker image with Buildx
40+ # https://github.com/docker/build-push-action
41+ - name : Build and push Docker image
42+ uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
43+ with :
44+ context : .
45+ push : true
46+ tags : ${{ steps.meta.outputs.tags }}
47+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments