]> Repositorios git - scryer-prolog.git/commitdiff
Adjust Github Action: Docker Publish
authorNiklas Gruhn <[email protected]>
Mon, 14 Nov 2022 22:19:07 +0000 (23:19 +0100)
committerNiklas Gruhn <[email protected]>
Tue, 15 Nov 2022 17:55:15 +0000 (18:55 +0100)
1. Not only publish Docker images when new release tags are created but
   on every push to master, since release frequency is so low.

2. Use newer versions of the various actions (setup-buildx-action,
   login-action, metadata-action, ...) to suppress some deprecation
   warnings see:
   https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

.github/workflows/docker-publish.yml

index b31829e789a72b28be16b90ce19ef4445a2d123d..dffe1cd7d9c8cf9983b6d45c93e5a9f5291a69e7 100644 (file)
@@ -2,10 +2,10 @@ name: Docker Publish
 
 on:
   push:
-    tags: [ 'v*.*.*' ]
-
-env:
-  IMAGE_NAME: mjt128/scryer-prolog
+    branches: 
+      - 'master'
+    tags: 
+      - 'v*.*.*'
 
 jobs:
   build:
@@ -18,33 +18,36 @@ jobs:
 
       # Workaround: https://github.com/docker/build-push-action/issues/461
       - name: Setup Docker buildx
-        uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
+        # https://github.com/docker/setup-buildx-action
+        uses: docker/[email protected]
 
       # Login against Docker registry
-      # https://github.com/docker/login-action
       - name: Log into registry
-        uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
+        # https://github.com/docker/login-action
+        uses: docker/[email protected]
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
 
       # Extract Docker image tag from git tag. E.g. if git tag is "v0.19.1" then use 
-      # Docker image tag "0.19.1". Tag "latest" is automatically synced with newest
-      # version.
-      # https://github.com/docker/metadata-action
+      # Docker image tag "0.19.1". The "latest" tag reflects the most recent build on
+      # master.
       - name: Extract Docker metadata
         id: meta
-        uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+        # https://github.com/docker/metadata-action
+        uses: docker/[email protected]
         with:
-          images: docker.io/${{ env.IMAGE_NAME }}
+          images: docker.io/${{ secrets.DOCKERHUB_USERNAME }}/scryer-prolog
           tags: |
             type=semver,pattern={{version}}
+            type=raw,value=latest,enable={{is_default_branch}}
+            # type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
 
       # Build and push Docker image with Buildx
-      # https://github.com/docker/build-push-action
       - name: Build and push Docker image
         id: build-and-push
-        uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+        # https://github.com/docker/build-push-action
+        uses: docker/[email protected]
         with:
           context: .
           push: true