Skip to content

Commit

Permalink
Merge pull request #99 from pataquets/docker-publish--get-image-tags-…
Browse files Browse the repository at this point in the history
…from-git

Publish Docker image action: get image tags from git's.
  • Loading branch information
8go authored Oct 5, 2022
2 parents e09a4f1 + 5d6f2db commit 2fc05b9
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 2fc05b9

Please sign in to comment.