|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - georchestra-gn4.4.x |
| 7 | + - gn-out-of-core-georchestra |
| 8 | + pull_request: |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + if: "!startsWith(github.event.head_commit.message, '[skip ci] ')" |
| 14 | + name: "📦 Build, test and publish on Docker Hub" |
| 15 | + runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 40 |
| 17 | + steps: |
| 18 | + - name: "Checking out" |
| 19 | + uses: actions/checkout@v2.4.0 |
| 20 | + with: |
| 21 | + submodules: 'recursive' |
| 22 | + |
| 23 | + - name: "Setting up Java" |
| 24 | + uses: actions/setup-java@v2 |
| 25 | + with: |
| 26 | + java-version: '11' |
| 27 | + distribution: 'adopt' |
| 28 | + |
| 29 | + - name: "Installing GeoNetwork" |
| 30 | + run: mvn clean install -DskipTests -Pdatahub-integration |
| 31 | + |
| 32 | + - name: "run tests" |
| 33 | + run: mvn verify -Pit |
| 34 | + |
| 35 | + - name: "publish the webapp as artifact" |
| 36 | + if: github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' && github.ref == 'refs/heads/georchestra-gn4.4.x' && github.event_name != 'pull_request' |
| 37 | + uses: actions/upload-artifact@v4 |
| 38 | + with: |
| 39 | + name: geonetwork.war |
| 40 | + path: web/target/geonetwork.war |
| 41 | + |
| 42 | + - name: Getting image tag |
| 43 | + if: github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' |
| 44 | + id: version |
| 45 | + run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT |
| 46 | + |
| 47 | + - name: "🐳 Build GeoNetwork docker image" |
| 48 | + if: github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' |
| 49 | + run: | |
| 50 | + cd web |
| 51 | + mvn package -Pdocker,datahub-integration -DdockerImageName=georchestra/geonetwork -DdockerImageTags=${{ steps.version.outputs.VERSION }},latest -DskipTests -ntp |
| 52 | +
|
| 53 | + - name: "Logging in docker.io" |
| 54 | + uses: azure/docker-login@v2 |
| 55 | + if: github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' |
| 56 | + with: |
| 57 | + username: '${{ secrets.DOCKER_HUB_USERNAME }}' |
| 58 | + password: '${{ secrets.DOCKER_HUB_PASSWORD }}' |
| 59 | + |
| 60 | + - name: "Pushing latest to docker.io" |
| 61 | + if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' |
| 62 | + run: | |
| 63 | + docker push georchestra/geonetwork:latest |
| 64 | +
|
| 65 | + - name: "Pushing release branch to docker.io" |
| 66 | + if: (contains(github.ref, 'refs/tags/') || endsWith(github.ref, '.x')) && github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' |
| 67 | + run: | |
| 68 | + docker push georchestra/geonetwork:${{ steps.version.outputs.VERSION }} |
| 69 | +
|
| 70 | + - name: "Update Docker Hub Description" |
| 71 | + if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/geonetwork' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' |
| 72 | + uses: peter-evans/dockerhub-description@v3 |
| 73 | + with: |
| 74 | + username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 75 | + password: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 76 | + repository: georchestra/geonetwork |
| 77 | + readme-filepath: ./geonetwork/DOCKER_HUB.md |
| 78 | + short-description: 'Geonetwork module for the geOrchestra SDI' |
0 commit comments