name: Publish Docker Image on: push: tags: - '*.*.*' - '!*.*.*-*' jobs: docker-publish: runs-on: ubuntu-latest steps: # https://stackoverflow.com/questions/58177786 - name: Get version run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Log in to the Container registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v2 with: push: true tags: | n1try/wakapi:latest n1try/wakapi:${{ env.GIT_TAG }} ghcr.io/${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }} platforms: linux/amd64,linux/arm64 cache-from: type=registry,ref=n1try/wakapi:buildcache cache-to: type=registry,ref=n1try/wakapi:buildcache,mode=max - name: Build and push (Alpine) uses: docker/build-push-action@v2 with: file: Dockerfile.alpine push: true tags: | n1try/wakapi:latest-alpine n1try/wakapi:${{ env.GIT_TAG }}-alpine ghcr.io/${{ github.repository }}:latest-alpine ghcr.io/${{ github.repository }}:${{ env.GIT_TAG }}-alpine platforms: linux/amd64,linux/arm64 cache-from: type=registry,ref=n1try/wakapi:buildcache-alpine cache-to: type=registry,ref=n1try/wakapi:buildcache-alpine,mode=max