Skip to content

WIP

WIP #1077

Workflow file for this run

# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
pull_request:
branches: [ master ]
schedule:
- cron: '20 15 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone opensha fork
if: github.event.schedule != '20 15 * * 0'
uses: actions/checkout@v2
with:
repository: GNS-Science/opensha
ref: fix/rup-normalization-2024
path: opensha
- name: Clone opensha
if: github.event.schedule == '20 15 * * 0'
uses: actions/checkout@v2
with:
repository: opensha/opensha
ref: master
path: opensha
- uses: actions/checkout@v2
with:
path: main
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Build with Gradle
run: |
cd main
chmod +x gradlew
./gradlew check -x test
./gradlew integrationTest -S
- name: Set version env var
if: startsWith(github.ref, 'refs/tags/release')
run: echo "TAG_VERSION=$(echo ${{github.ref}} | cut -d'/' -f 4)" >> $GITHUB_ENV
- name: Set fatjar name
if: startsWith(github.ref, 'refs/tags/release')
run: echo "JAR_NAME=nzshm-opensha-all-${{env.TAG_VERSION}}.jar" >> $GITHUB_ENV
- name: Build FatJar with Gradle
if: startsWith(github.ref, 'refs/tags/release')
run: |
cd opensha
git rev-parse HEAD > ../main/src/main/resources/opensha-ref.txt
cd ../main
echo "${{env.TAG_VERSION}}" > src/main/resources/tagged-version.txt
chmod +x gradlew
./gradlew fatjar
mv build/libs/nzshm-opensha-all.jar build/libs/${{env.JAR_NAME}}
- uses: GNS-Science/s3-sync-action@master
with:
args: --acl public-read
if: startsWith(github.ref, 'refs/tags/release')
name: Upload to S3
id: S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.RELEASE_AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_AWS_SECRET_ACCESS_KEY}}
AWS_S3_BUCKET: ${{ secrets.RELEASE_AWS_BUCKET }}
AWS_REGION: 'ap-southeast-2'
SOURCE_DIR: main/build/libs/
destination_dir: ''