Merge pull request #4333 from georchestra/backport/23.0.x/pr-4331 #17
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: "console" | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "ldap/**" | |
- "postgresql/**" | |
- "commons/**" | |
- "ldap-account-management/**" | |
- "console/**" | |
pull_request: | |
paths: | |
- "ldap/**" | |
- "postgresql/**" | |
- "commons/**" | |
- "ldap-account-management/**" | |
- "console/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: "Checking out" | |
uses: actions/checkout@v1 | |
- name: "Setting up Java" | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
cache: 'maven' | |
server-id: geOrchestra-artifactory | |
server-username: ARTIFACTORY_USERNAME_REF | |
server-password: ARTIFACTORY_TOKEN_REF | |
- name: "Installing & checking formatting" | |
run: ./mvnw install -pl :console --also-make -P-all,console --no-transfer-progress -B -Dfmt.action=validate -Dadditionalparam=-Xdoclint:none -DskipTests | |
# note "-pl :console --also-make" builds only the project and its dependencies | |
- name: "Building LDAP and PostgreSQL docker images" | |
if: github.repository == 'georchestra/georchestra' | |
run: | | |
docker build -t georchestra/ldap:latest ./ldap | |
docker build -t georchestra/database:latest ./postgresql | |
- name: "Running tests" | |
working-directory: console/ | |
run: ../mvnw verify --no-transfer-progress -Dfmt.skip=true -Dadditionalparam=-Xdoclint:none -Dskip.npm | |
- name: Getting image tag | |
if: github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
id: version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: "Building docker image" | |
if: github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
working-directory: console/ | |
run: ../mvnw --no-transfer-progress clean package docker:build -Pdocker,log4j-logstash,sentry-log4j -DdockerImageName=georchestra/console:${{ steps.version.outputs.VERSION }} -DskipTests | |
- name: "Logging in docker.io" | |
if: github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
uses: azure/docker-login@v1 | |
with: | |
username: '${{ secrets.DOCKER_HUB_USERNAME }}' | |
password: '${{ secrets.DOCKER_HUB_PASSWORD }}' | |
- name: "Pushing latest to docker.io" | |
if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
run: | | |
docker tag georchestra/console:${{ steps.version.outputs.VERSION }} georchestra/console:latest | |
docker push georchestra/console:latest | |
- name: "Pushing release branch to docker.io" | |
if: contains(github.ref, 'refs/heads/23.') && github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
run: | | |
docker push georchestra/console:${{ steps.version.outputs.VERSION }} | |
- name: "Pushing release tag to docker.io" | |
if: contains(github.ref, 'refs/tags/23.') && github.repository == 'georchestra/georchestra' && github.actor != 'dependabot[bot]' | |
run: | | |
docker push georchestra/console:${{ steps.version.outputs.VERSION }} | |
- name: "Publish war in artifactory" | |
run: ./mvnw deploy -pl :console --also-make -P-all,console --no-transfer-progress -DskipTests | |
continue-on-error: true | |
env: | |
ARTIFACTORY_TOKEN_REF: ${{ secrets.ARTIFACTORY_TOKEN }} | |
ARTIFACTORY_USERNAME_REF: ${{ secrets.ARTIFACTORY_USERNAME }} | |
- name: "Remove SNAPSHOT jars from repository" | |
run: | | |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {} |