Merge pull request #14 from GateNLP/dependabot/maven/mimir-connector/… #8
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: CI | |
on: | |
# Rebuild whenever there's a push to master | |
push: | |
branches: | |
- master | |
# Prevent concurrent builds of the same branch - a new push will cancel the | |
# running workflow and start another | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
checks: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Master Branch | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
continue-on-error: true | |
# This step may error out when run in a fork that doesn't have pages | |
# enabled - if this happens, run the rest but skip anything that | |
# involves publishing to pages. The last thing configure-pages does | |
# is set an environment variable GITHUB_PAGES=true which is visible | |
# to subsequent steps, so we can condition on that. | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'zulu' | |
cache: maven | |
- name: Save Gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
# Override http://repo.gate.ac.uk to use https:// instead | |
- name: Configure Maven settings | |
uses: whelk-io/maven-settings-xml-action@v20 | |
with: | |
mirrors: > | |
[ | |
{ | |
"id": "gate.ac.uk-https", | |
"name": "GATE repo (secure)", | |
"mirrorOf": "gate.ac.uk", | |
"url": "https://repo.gate.ac.uk/content/groups/public/" | |
} | |
] | |
repositories: > | |
[ | |
{ | |
"id": "central", | |
"name": "Maven Central", | |
"url": "https://repo1.maven.org/maven2", | |
"releases": { | |
"enabled": "true" | |
}, | |
"snapshots": { | |
"enabled": "false" | |
} | |
} | |
] | |
plugin_repositories: > | |
[ | |
{ | |
"id": "central", | |
"name": "Maven Central", | |
"url": "https://repo1.maven.org/maven2", | |
"releases": { | |
"enabled": "true" | |
}, | |
"snapshots": { | |
"enabled": "false" | |
} | |
} | |
] | |
servers: > | |
[ | |
{ | |
"id": "gate.snapshots", | |
"username": "${{ secrets.GATE_REPO_USERNAME }}", | |
"password": "${{ secrets.GATE_REPO_PASSWORD }}" | |
} | |
] | |
- name: Build core components with Maven | |
run: mvn --batch-mode -e clean install | |
- name: Publish Test Report | |
uses: scacap/action-surefire-report@v1 | |
with: | |
fail_if_no_tests: false | |
- name: Build mimir-cloud with Gradle | |
working-directory: webapp/mimir-cloud | |
run: | | |
./gradlew --console=plain runCommand -Pargs=cache-mimir-plugins | |
./gradlew --console=plain assemble | |
- name: Build site | |
run: mvn --batch-mode -e -DskipTests site site:stage -DtopSiteURL=https://gatenlp.github.io/mimir/ | |
- name: Upload artifact | |
if: env.GITHUB_PAGES == 'true' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: 'target/staging' | |
# Only do the deploy and distro if we're in the main GateNLP repo, not a fork | |
- name: Deploy core components to repo.gate.ac.uk | |
if: github.repository == 'GateNLP/mimir' && github.ref == 'refs/heads/master' | |
run: mvn --batch-mode -e -Dmaven.test.skip=true source:jar javadoc:jar deploy | |
- name: Deploy mimir-web-ui to repo.gate.ac.uk | |
if: github.repository == 'GateNLP/mimir' && github.ref == 'refs/heads/master' | |
working-directory: webapp/mimir-web-ui | |
run: ./gradlew --console=plain publish | |
env: | |
GATE_REPO_USERNAME: ${{ secrets.GATE_REPO_USERNAME }} | |
GATE_REPO_PASSWORD: ${{ secrets.GATE_REPO_PASSWORD }} | |
- name: Deploy mimir-web plugin to repo.gate.ac.uk | |
if: github.repository == 'GateNLP/mimir' && github.ref == 'refs/heads/master' | |
working-directory: webapp/mimir-web | |
run: ./gradlew --console=plain publish | |
env: | |
GATE_REPO_USERNAME: ${{ secrets.GATE_REPO_USERNAME }} | |
GATE_REPO_PASSWORD: ${{ secrets.GATE_REPO_PASSWORD }} | |
- name: Deploy mimir-cloud WAR file to repo.gate.ac.uk | |
if: github.repository == 'GateNLP/mimir' && github.ref == 'refs/heads/master' | |
working-directory: webapp/mimir-cloud | |
run: ./gradlew --console=plain publish | |
env: | |
GATE_REPO_USERNAME: ${{ secrets.GATE_REPO_USERNAME }} | |
GATE_REPO_PASSWORD: ${{ secrets.GATE_REPO_PASSWORD }} | |
# We want to avoid cacheing -SNAPSHOT dependencies from our local maven | |
# cache, to ensure that we always go out and check for them again at the | |
# next build in case they have changed. | |
- name: Delete snapshots from m2 repository | |
if: always() | |
run: | | |
find ~/.m2/repository -name \*-SNAPSHOT -type d -exec rm -rf {} \+ || : | |
- name: Deploy site to GitHub Pages | |
if: env.GITHUB_PAGES == 'true' | |
id: deployment | |
uses: actions/deploy-pages@v1 |