11name : package
22
33on :
4- push :
5- merge_group :
4+ push : {}
5+ workflow_dispatch : {}
66
77permissions :
88 packages : write
@@ -12,33 +12,35 @@ jobs:
1212 runs-on : ubuntu-latest
1313 steps :
1414 - uses : actions/checkout@v3
15- - name : Set up
16- run : |
17- docker --version
18- docker-compose --version
19- echo "${GITHUB_REF}"
20- - name : Build docker images
21- run : |
22- make build
23- # make cached-build
24- - name : Push docker images (hash)
25- # if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')) && github.actor != 'dependabot[bot]'
26- run : |
27- echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
28-
29- docker tag ghcr.io/alephdata/ingest-file ghcr.io/alephdata/ingest-file:${GITHUB_SHA}
30- docker push ghcr.io/alephdata/ingest-file:${GITHUB_SHA}
31- docker tag ghcr.io/alephdata/ingest-file ghcr.io/alephdata/ingest-file:cache
32- docker push ghcr.io/alephdata/ingest-file:cache
33- - name : Push docker images for tags
34- # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
35- run : |
36- export TAG=${GITHUB_REF/refs\/tags\//}
37-
38- docker tag ghcr.io/alephdata/ingest-file ghcr.io/alephdata/ingest-file:${TAG};
39- docker push ghcr.io/alephdata/ingest-file:${TAG};
40-
41- - name : Tag latest image
42- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !startsWith(github.ref, 'refs/tags/test-')
43- run : |
44- docker push ghcr.io/alephdata/ingest-file;
15+ - name : Set up QEMU
16+ uses : docker/setup-qemu-action@v2
17+ - name : Docker meta
18+ id : meta
19+ uses : docker/metadata-action@v4
20+ with :
21+ images : ghcr.io/investigativedata/ingest-file
22+ tags : |
23+ type=ref,event=branch
24+ type=semver,pattern={{version}}
25+ type=sha
26+ type=raw,value=latest
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v2
29+ with :
30+ install : true
31+ - name : Login to GitHub Container Registry
32+ uses : docker/login-action@v2
33+ with :
34+ registry : ghcr.io
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+ - name : Build and push release
38+ uses : docker/build-push-action@v3
39+ with :
40+ context : .
41+ # platforms: linux/amd64,linux/arm64
42+ push : true
43+ tags : ${{ steps.meta.outputs.tags }}
44+ labels : ${{ steps.meta.outputs.labels }}
45+ cache-from : type=gha
46+ cache-to : type=gha,mode=max
0 commit comments