fix build docker image version #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- num-main | |
- 'feature/**' | |
- 'feat/**' | |
- 'fix/**' | |
paths-ignore: | |
- '.circleci/**' | |
- '.docker_scripts/**' | |
- 'doc/**' | |
- 'tests/**' | |
- '**/*.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'maven' | |
- name: Set some variables for the build | |
run: | | |
if [ ${{ github.ref }} != 'refs/heads/num-main' ]; then | |
echo "IS NOT num-main branch" | |
echo "BUILD_VERSION=0.32.x-num-$GITHUB_RUN_NUMBER-PR" >> $GITHUB_ENV | |
else | |
echo "IS main branch" | |
echo "BUILD_VERSION=0.32.x-num-$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: See some values | |
run: | | |
echo "GITHUB_REF=$GITHUB_REF" | |
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME" | |
echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" | |
echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" | |
echo "BUILD_VERSION=$BUILD_VERSION" | |
- name: Echo Env Vars through Context | |
run: | | |
echo "$GITHUB_CONTEXT" | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set Build-Version in pom.xml | |
run: ./mvnw versions:set -DnewVersion=$BUILD_VERSION | |
- name: Build with Maven | |
run: ./mvnw verify | |
- name: Docker push image | |
run: ./mvnw -pl build-docker-image io.fabric8:docker-maven-plugin:0.40.2:push |