organizing utils #61
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 and Update Container Image | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: homolog | |
env: | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: nelonoel/[email protected] | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build Maven package | |
run: mvn --batch-mode --update-snapshots package | |
working-directory: backend | |
env: | |
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" | |
- name: Update container image | |
run: | | |
docker build -t dscatalog:latest . | |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USER" --password-stdin | |
docker tag dscatalog:latest $DOCKERHUB_USER/dscatalog:latest | |
docker push $DOCKERHUB_USER/dscatalog | |
working-directory: backend | |
- run: echo "done build project and upload container image" |