@@ -20,25 +20,16 @@ jobs:
2020 # Steps represent a sequence of tasks that will be executed as part of the job
2121 steps :
2222 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23- - uses : actions/checkout@v2
23+ - uses : actions/checkout@v3
2424
25- - uses : actions/setup-java@v1
25+ - uses : actions/setup-java@v3
2626 with :
27+ distribution : temurin
2728 java-version : 11
2829
29- - name : Cache
30- uses : actions/cache@v2
31- with :
32- # Cache gradle directories
33- path : |
34- ~/.gradle/caches
35- ~/.gradle/wrapper
36- # Key for restoring and saving the cache
37- key : ${{ runner.os }}-gradle-${{ hashFiles('gradlew', '**/*.gradle', 'gradle.properties', 'gradle/**') }}
38- restore-keys : |
39- ${{ runner.os }}-gradle-
30+ - name : Setup Gradle
31+ uses : gradle/gradle-build-action@v2
4032
41- # Compile the code
4233 - name : Compile code
4334 run : ./gradlew assemble
4435
@@ -53,25 +44,26 @@ jobs:
5344 # Steps represent a sequence of tasks that will be executed as part of the job
5445 steps :
5546 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
56- - uses : actions/checkout@v2
47+ - uses : actions/checkout@v3
5748
5849 - name : Docker build parameters
5950 id : docker_params
6051 run : |
61- echo "::set-output name=has_docker_login::${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
62- if [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then
63- echo "::set-output name=push::false"
64- echo "::set-output name=load::true"
65- echo "::set-output name=platforms::linux/amd64"
52+ HAS_DOCKER_LOGIN=${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
53+ echo "has_docker_login=$HAS_DOCKER_LOGIN" >> $GITHUB_OUTPUT
54+ if [ "${{ github.event_name == 'pull_request' }}" = "true" ] || [ "$HAS_DOCKER_LOGIN" = "false" ]; then
55+ echo "push=false" >> $GITHUB_OUTPUT
56+ echo "load=true" >> $GITHUB_OUTPUT
57+ echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
6658 else
67- echo "::set-output name= push:: true"
68- echo "::set-output name= load:: false"
69- echo "::set-output name= platforms:: linux/amd64,linux/arm64"
59+ echo "push= true" >> $GITHUB_OUTPUT
60+ echo "load= false" >> $GITHUB_OUTPUT
61+ echo "platforms= linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
7062 fi
7163
7264 - name : Cache Docker layers
7365 id : cache_buildx
74- uses : actions/cache@v2
66+ uses : actions/cache@v3
7567 with :
7668 path : /tmp/.buildx-cache
7769 key : ${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-${{ hashFiles('**/Dockerfile', '**/*.gradle', 'gradle.properties', '.dockerignore', '*/src/main/**', 'docker/**') }}
@@ -81,24 +73,24 @@ jobs:
8173
8274 - name : Login to Docker Hub
8375 if : steps.docker_params.outputs.has_docker_login == 'true'
84- uses : docker/login-action@v1
76+ uses : docker/login-action@v2
8577 with :
8678 username : ${{ secrets.DOCKERHUB_USERNAME }}
8779 password : ${{ secrets.DOCKERHUB_TOKEN }}
8880
8981 # Add Docker labels and tags
9082 - name : Docker meta
9183 id : docker_meta
92- uses : crazy-max/ghaction-docker-meta@v2
84+ uses : docker/metadata-action@v4
9385 with :
9486 images : ${{ env.DOCKER_IMAGE }}
9587
9688 # Setup docker build environment
9789 - name : Set up QEMU
98- uses : docker/setup-qemu-action@v1
90+ uses : docker/setup-qemu-action@v2
9991
10092 - name : Set up Docker Buildx
101- uses : docker/setup-buildx-action@v1
93+ uses : docker/setup-buildx-action@v2
10294
10395 - name : Cache parameters
10496 id : cache-parameters
@@ -110,8 +102,9 @@ jobs:
110102 fi
111103
112104 - name : Build docker
113- uses : docker/build-push-action@v2
105+ uses : docker/build-push-action@v3
114106 with :
107+ context : .
115108 cache-from : type=local,src=/tmp/.buildx-cache
116109 cache-to : ${{ steps.cache-parameters.outputs.cache-to }}
117110 platforms : ${{ steps.docker_params.outputs.platforms }}
@@ -134,8 +127,11 @@ jobs:
134127 - name : Inspect docker image
135128 run : |
136129 docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
137- docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --help
130+ docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --version
131+
138132
133+ # https://github.com/docker/build-push-action/issues/252
134+ # https://github.com/moby/buildkit/issues/1896
139135 - name : Move docker build cache
140136 if : steps.cache_buildx.outputs.cache-hit != 'true'
141137 run : |
0 commit comments