feat: add semantic versioniong
This commit is contained in:
@@ -10,31 +10,32 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Push Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
DOCKER_REGISTRY: git.trai-infra.comstack.de
|
||||
DOCKER_IMAGE: marian.lippitz/tap-frontend
|
||||
# You can set the username directly here, or as an environment secret
|
||||
# If using secrets, remove the line below and set in GitHub secrets
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Validate Conventional Commits
|
||||
run: |
|
||||
git log -1 --pretty=%B | grep -Eq "^(feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert)(\(.+\))?: .+"
|
||||
shell: bash
|
||||
|
||||
- name: Calculate Semantic Version tag
|
||||
id: semver
|
||||
uses: gandarez/semver-action@v2.0.0
|
||||
with:
|
||||
main_branch_name: main
|
||||
|
||||
- name: Extract Variables
|
||||
id: vars
|
||||
run: |
|
||||
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
||||
echo "DOCKER_TAG=${BRANCH_NAME}-${COMMIT_HASH}" >> $GITHUB_ENV
|
||||
echo "SEMVER_TAG=${{ steps.semver.outputs.semver_tag }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Docker Login
|
||||
env:
|
||||
@@ -45,9 +46,9 @@ jobs:
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t "$DOCKER_REGISTRY/$DOCKER_IMAGE:latest" -t "$DOCKER_REGISTRY/$DOCKER_IMAGE:$DOCKER_TAG" .
|
||||
docker build -t "$DOCKER_REGISTRY/$DOCKER_IMAGE:latest" -t "$DOCKER_REGISTRY/$DOCKER_IMAGE:$SEMVER_TAG" .
|
||||
|
||||
- name: Push Docker Image
|
||||
- name: Push Docker Images
|
||||
run: |
|
||||
docker push "$DOCKER_REGISTRY/$DOCKER_IMAGE:latest"
|
||||
docker push "$DOCKER_REGISTRY/$DOCKER_IMAGE:$DOCKER_TAG"
|
||||
docker push "$DOCKER_REGISTRY/$DOCKER_IMAGE:$SEMVER_TAG"
|
||||
|
||||
Reference in New Issue
Block a user