Skip to content

Commit

Permalink
Build docker container only on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Aug 23, 2023
1 parent 2906e82 commit afc3a0e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build

on:
push:
branches:
- 'sbdi-dev'
tags:
- 'v*'

Expand Down Expand Up @@ -33,19 +35,22 @@ jobs:
path: build/libs

- name: Log in to the Container registry
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
Expand Down

0 comments on commit afc3a0e

Please sign in to comment.