Skip to content

Commit

Permalink
update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
NikoHadouken committed Nov 13, 2024
1 parent aeec11b commit e7069b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Push Docker Image to GHCR
on:
push:
tags:
- '*' # Trigger on any tag creation
- 'v*' # Trigger only on tags that start with 'v'

jobs:
build:
Expand All @@ -22,12 +22,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} # GitHub token is automatically provided

# Extract version from tag (remove leading 'v')
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

# Build the Docker image
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}/sherpa-api-mock:${{ github.ref_name }} .
docker build -t ghcr.io/${{ github.repository }}:${{ env.VERSION }} .
# Push the Docker image to GitHub Container Registry
- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository }}/sherpa-api-mock:${{ github.ref_name }}
docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }}

0 comments on commit e7069b8

Please sign in to comment.