1
0
Fork 0

Publish tag to Docker Hub

This tags the versions released on Docker Hub so we
can rely on those versions rather than the sha.
This commit is contained in:
James DiGioia 2021-01-10 17:08:00 -05:00 committed by GitHub
parent f7c76adfd8
commit beb0502fb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,6 +52,19 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
- name: Get publish tag
id: publish
run: |
if [[ $GITHUB_REF != refs/tags/* ]]; then
TAG="${GITHUB_REF##*/}"
else
TAG=$GITHUB_SHA
fi
echo ::set-output name=tag::${TAG}
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_SHA: ${{ github.sha }}
- name: Build and push - name: Build and push
id: docker_build id: docker_build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
@ -62,12 +75,12 @@ jobs:
push: true push: true
tags: | tags: |
${{ secrets.DOCKER_USERNAME }}/archivebox:latest ${{ secrets.DOCKER_USERNAME }}/archivebox:latest
${{ secrets.DOCKER_USERNAME }}/archivebox:${{ github.sha }} ${{ secrets.DOCKER_USERNAME }}/archivebox:${{ steps.publish.outputs.tag }}
archivebox/archivebox:latest archivebox/archivebox:latest
archivebox/archivebox:${{ github.sha }} archivebox/archivebox:${{ steps.publish.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}