Skip to content

Commit

Permalink
Shortening the image name
Browse files Browse the repository at this point in the history
  • Loading branch information
spaquet committed Jan 18, 2024
1 parent 26306c5 commit 8153125
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
runs-on: ubuntu-latest
environment: docker-image-build
steps:
- name: Set Image Name
id: image_name
run: echo "IMAGE_NAME=thepew" >> $GITHUB_ENV

- name: Check Out Repository
uses: actions/checkout@v3

Expand All @@ -29,9 +33,9 @@ jobs:
- name: Extract Version
id: version
run: |
MAJOR_MINOR=`cat VERSION` # Replace with your way to extract version
BUILD_NUMBER=${GITHUB_RUN_NUMBER} # Or use ${GITHUB_SHA::8} for commit SHA
echo "VERSION_TAG=${MAJOR_MINOR}.${BUILD_NUMBER}" >> $GITHUB_ENV
MAJOR_MINOR=`cat VERSION`
SHORT_SHA=$(echo $GITHUB_SHA | cut -c 1-7) # Extracts first 7 characters of the commit SHA
echo "VERSION_TAG=${MAJOR_MINOR}-${SHORT_SHA}" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
Expand All @@ -41,4 +45,4 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/your-image-name:${{ env.VERSION_TAG }}
tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION_TAG }}

0 comments on commit 8153125

Please sign in to comment.