Skip to content

Commit

Permalink
Publish Docker image action: get image tags from git's (followup for #77
Browse files Browse the repository at this point in the history
).
  • Loading branch information
pataquets committed Oct 4, 2022
1 parent 6a752f2 commit 5d6f2db
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Publish Docker image

env:
DOCKERHUB_IMAGE: matrix-commander

# on: push
# on: pull_request
# on:
Expand All @@ -24,10 +21,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(cat VERSION)"

# Required if building multi-arch images
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -45,10 +38,23 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@v3
with:
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE }}:latest, ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE }}:${{ steps.getversion.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 5d6f2db

Please sign in to comment.