@@ -2,8 +2,6 @@ name: 'build images'
22
33on :
44 workflow_dispatch :
5- # schedule:
6- # - cron: '7 5 * * *'
75 push :
86
97jobs :
@@ -16,36 +14,24 @@ jobs:
1614 - name : Prepare
1715 id : prep
1816 run : |
19- DOCKER_IMAGE=trion/local-git
17+ DOCKER_IMAGE=ghcr.io/ trion-development /local-git
2018 VERSION=latest
2119 SHORTREF=${GITHUB_SHA::8}
2220
23- #use branch as version
24- if [[ $GITHUB_REF == refs/heads/* ]]; then
25- VERSION=${GITHUB_REF#refs/heads/}
26- [ $VERSION == "master" ] && VERSION=latest
27- fi
28-
29- #use tag as version
21+ # If this is git tag, use the tag name as a docker tag
3022 if [[ $GITHUB_REF == refs/tags/* ]]; then
31- VERSION=${GITHUB_REF#refs/tags/}
23+ VERSION=${GITHUB_REF#refs/tags/v }
3224 fi
3325
34- #use version as image tag
3526 TAGS="${DOCKER_IMAGE}:${VERSION}"
3627
37- # If version is a number also tag it 'latest'.
38- if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
39- TAGS="$TAGS,${DOCKER_IMAGE}:latest"
40- fi
41-
4228 echo ::set-output name=tags::${TAGS}
4329 echo ::set-output name=docker_image::${DOCKER_IMAGE}
4430
4531 - name : Set up QEMU
46- uses : docker/setup-qemu-action@master
32+ uses : docker/setup-qemu-action@v2
4733 with :
48- platforms : all
34+ platforms : arm64
4935
5036 - name : Set up Docker Buildx
5137 id : buildx
@@ -55,19 +41,19 @@ jobs:
5541 uses : actions/cache@v3
5642 with :
5743 path : /tmp/.buildx-cache
58- key : ${{ runner.os }}-buildx-${{ github.sha }}
44+ key : ${{ runner.os }}-buildx-${TARGETARCH}-${ { github.sha }}
5945 restore-keys : |
60- ${{ runner.os }}-buildx-
46+ ${{ runner.os }}-buildx-${TARGETARCH}-
6147
62- - name : Login to DockerHub
63- if : github.event_name != 'pull_request'
48+ - name : ' Login to GitHub Container Registry'
6449 uses : docker/login-action@v2
6550 with :
66- username : ${{ secrets.DOCKER_USERNAME }}
67- password : ${{ secrets.DOCKER_PASSWORD }}
51+ registry : ghcr.io
52+ username : ${{github.actor}}
53+ password : ${{secrets.GITHUB_TOKEN}}
6854
6955 - name : Build
70- uses : docker/build-push-action@v2
56+ uses : docker/build-push-action@v4
7157 with :
7258 builder : ${{ steps.buildx.outputs.name }}
7359 context : .
0 commit comments