Skip to content

Merge pull request #159 from GateNLP/dependabot/maven/com.fasterxml.j… #16

Merge pull request #159 from GateNLP/dependabot/maven/com.fasterxml.j…

Merge pull request #159 from GateNLP/dependabot/maven/com.fasterxml.j… #16

Workflow file for this run

name: CI
on:
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: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: "3.8.8"
# 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 with Maven
run: mvn --batch-mode -e clean install
- name: Publish Test Report
if: success() || failure()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "target/surefire-reports/*.xml"
- name: Build site
run: mvn --batch-mode -e -DskipTests site
- name: Upload artifact
if: env.GITHUB_PAGES == 'true'
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: 'target/site'
# Only do the deply and distro if we're in the main GateNLP repo, not a fork
- name: Deploy to repo.gate.ac.uk
if: github.repository == 'GateNLP/gate-core' && github.ref == 'refs/heads/master'
run: mvn --batch-mode -e -Dmaven.test.skip=true source:jar javadoc:jar deploy
- name: Fetch latest userguide
if: github.repository == 'GateNLP/gate-core' && github.ref == 'refs/heads/master'
run: wget -O target/tao.pdf https://gate.ac.uk/sale/tao/tao.pdf
- name: Build and deploy distribution
if: github.repository == 'GateNLP/gate-core' && github.ref == 'refs/heads/master'
run: cd distro && mvn --batch-mode -e "-Dtao.pdf=$GITHUB_WORKSPACE/target/tao.pdf" -Pinstaller deploy
# 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
id: deployment
uses: actions/deploy-pages@v1
if: env.GITHUB_PAGES == 'true'
downstream:
needs: build
runs-on: ubuntu-latest
if: github.repository == 'GateNLP/gate-core' && github.ref == 'refs/heads/master'
steps:
- name: "Trigger gate-top"
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GATE_TOP_TOKEN }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "GateNLP",
repo: "gate-top",
workflow_id: "ci.yaml",
ref: "master",
});