Skip to content

Commit

Permalink
update ci builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rjonczy committed Apr 18, 2024
1 parent 16887cf commit 866e2d9
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,42 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (branch, tags, sha)
id: meta
uses: docker/metadata-action@v4
- name: Extract metadata (tags, labels) for Docker (tag)
id: meta-tag
if: github.ref_type == 'tag'
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.ref_name }}-${{ github.run_id }}-${{ github.sha }}
type=semver,pattern=v*
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and Push Docker Image
uses: docker/build-push-action@v3
- name: Extract metadata (tags, labels) for Docker (branch)
id: meta-branch
if: github.ref_type == 'branch'
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-{{date 'YYYYMMDDHHmmss'}}-
- name: Build and Push Docker Image (tag)
if: github.ref_type == 'tag'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta-tag.outputs.tags }}
labels: ${{ steps.meta-tag.outputs.labels }}

- name: Build and Push Docker Image (branch)
if: github.ref_type == 'branch'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-branch.outputs.tags }}
labels: ${{ steps.meta-branch.outputs.labels }}

0 comments on commit 866e2d9

Please sign in to comment.