mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-12-27 19:07:28 +00:00
ci app version update
This commit is contained in:
parent
3306bf75bc
commit
298b12db33
1 changed files with 20 additions and 7 deletions
27
.github/workflows/ci-petclinic.yml
vendored
27
.github/workflows/ci-petclinic.yml
vendored
|
|
@ -67,20 +67,33 @@ jobs:
|
|||
- name: Login to Amazon ECR
|
||||
id: ecr-login
|
||||
uses: aws-actions/amazon-ecr-login@v2
|
||||
|
||||
- name: Set image tag
|
||||
id: vars
|
||||
run: |
|
||||
SHORT_SHA=${GITHUB_SHA::7}
|
||||
echo "IMAGE_TAG=${SHORT_SHA}" >> "$GITHUB_ENV"
|
||||
echo "IMAGE_TAG=${SHORT_SHA}"
|
||||
- name: Update application version (only on main)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
- name: Read base version from pom.xml
|
||||
run: |
|
||||
POM_VERSION=$(./mvnw -q \
|
||||
-Dexpression=project.version \
|
||||
-DforceStdout help:evaluate)
|
||||
echo "POM_VERSION=${POM_VERSION}"
|
||||
|
||||
# -SNAPSHOT suffix 제거
|
||||
BASE_VERSION=${POM_VERSION%-SNAPSHOT}
|
||||
echo "BASE_VERSION=${BASE_VERSION}"
|
||||
echo "BASE_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
|
||||
- name: Build APP_VERSION (base + image tag)
|
||||
run: |
|
||||
APP_VERSION="A-${BASE_VERSION}-${IMAGE_TAG}"
|
||||
|
||||
echo "APP_VERSION=${APP_VERSION}"
|
||||
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
|
||||
- name: Update application version property
|
||||
run: |
|
||||
APP_VERSION="A-${IMAGE_TAG}"
|
||||
echo "Set APP_VERSION: ${APP_VERSION}"
|
||||
# app.version 라인은 항상 존재한다고 가정
|
||||
sed -i "s/^app.version=.*/app.version=${APP_VERSION}/" src/main/resources/application.properties
|
||||
|
||||
- name: Build Docker image
|
||||
env:
|
||||
DOCKER_BUILDKIT: 1
|
||||
|
|
@ -123,5 +136,5 @@ jobs:
|
|||
git config user.email "github-actions@github.com"
|
||||
git status
|
||||
git add src/main/resources/application.properties k8s/20-petclinic-Deployments-postgre.yaml
|
||||
git commit -m "chore: update petclinic image to ${IMAGE_TAG}" || echo "No changes to commit"
|
||||
git commit -m "chore: update petclinic image to ${APP_VERSION}" || echo "No changes to commit"
|
||||
git push
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue