Skip to content

Commit

Permalink
#25 build Docker images and push them to Docker Hub when running mast…
Browse files Browse the repository at this point in the history
…er pipeline
  • Loading branch information
kasramp committed May 3, 2023
1 parent c3fd4a1 commit a699d63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
EMAIL: ${{ secrets.EMAIL }}
USERNAME: ${{ secrets.USERNAME }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
pwd ${GITHUB_WORKSPACE}
chmod +x "${GITHUB_WORKSPACE}/util/release.sh"
Expand Down
9 changes: 7 additions & 2 deletions util/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ if [[ "$LAST_COMMIT" != *"maven-release-plugin"* ]]; then
mvn -B clean release:clean release:prepare release:perform -Dusername=$USERNAME -Dpassword=$TOKEN -DtagNameFormat=@{artifactId}-beta-@{version} -Darguments="-Dmaven.deploy.skip=true"
else
mvn -B clean release:clean release:prepare release:perform -Dusername=$USERNAME -Dpassword=$TOKEN -Darguments="-Dmaven.deploy.skip=true" &&
mvn clean spring-boot:build-image &&
TAGGED_VERSION=$(git for-each-ref --sort=-creatordate --format='%(refname:short)' refs/tags --count 10 | grep -oP '^eris-(\d+).*' | head -1 | cut -d "-" -f2) &&
docker tag eris:"$TAGGED_VERSION" eris:latest &&
IMAGE_NAME=kasramp/eris &&
mvn versions:set -DnewVersion="$TAGGED_VERSION" &&
mvn spring-boot:build-image -Dspring-boot.build-image.imageName="$IMAGE_NAME":"$TAGGED_VERSION" &&
docker tag "$IMAGE_NAME":"$TAGGED_VERSION" "$IMAGE_NAME":latest &&
docker login -u "$DOCKER_USERNAME" --password-stdin <<< "$DOCKER_PASSWORD" &&
docker push "$IMAGE_NAME" --all-tags &&
git checkout pom.xml &&
git fetch origin develop && git merge origin/master &&
git push https://$USERNAME:$TOKEN@github.com/kasramp/Eris.git HEAD:develop
fi
Expand Down

0 comments on commit a699d63

Please sign in to comment.