Merge pull request #67 from georchestra/build/updgrade_gitcommitid_ma… #98
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 publish docker image" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: "Checking out" | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: "Setting up Java" | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
cache: 'maven' | |
- name: "Build georchestra dependencies" | |
run: make deps | |
- name: "Build gateway" | |
run: make install test | |
- name: "Resolve docker image tag" | |
id: version | |
run: echo ::set-output name=VERSION::$(./mvnw -f gateway/ help:evaluate -q -DforceStdout -Dexpression=imageTag) | |
- name: "Build docker image" | |
if: github.repository == 'georchestra/georchestra-gateway' | |
run: make docker | |
- name: "Log in to docker.io" | |
if: github.repository == 'georchestra/georchestra-gateway' | |
uses: azure/docker-login@v1 | |
with: | |
username: '${{ secrets.DOCKER_HUB_USERNAME }}' | |
password: '${{ secrets.DOCKER_HUB_PASSWORD }}' | |
- name: "Push latest to docker.io" | |
if: github.ref == 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' | |
run: docker push georchestra/gateway:latest | |
- name: "Push tagged image to docker.io" | |
if: github.ref != 'refs/heads/main' && github.repository == 'georchestra/georchestra-gateway' | |
run: docker push georchestra/gateway:${{ steps.version.outputs.VERSION }} | |
- name: "Remove SNAPSHOT jars from repository" | |
run: | | |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {} |