Update ci.yml #156
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation. | |
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
name: Runwar CI | |
# If your target is master or develop branch | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
# We get the required keys | |
workflow_call: | |
secrets: | |
AWS_ACCESS_KEY: | |
required: true | |
AWS_ACCESS_SECRET: | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Print JAVA_HOME | |
run: echo $JAVA_HOME | |
- name: Check Java version | |
run: java -version | |
- name: Configure Gradle to use the setup JDK | |
run: mkdir ~/.gradle/ && echo "org.gradle.java.home=$JAVA_HOME" >> ~/.gradle/gradle.properties | |
- name: Print Gradle properties | |
run: cat ~/.gradle/gradle.properties | |
- name: Create symlink to Java home | |
run: | | |
mkdir -p gradle/jvm/11 | |
ln -s $JAVA_HOME gradle/jvm/11/latest | |
# Do the build | |
- name: Build with Gradle | |
run: ./gradlew --refresh-dependencies | |
# Creating S3 destination folder name based on the version and copying just the jar into temp directory | |
- name: Change folder source | |
run: | | |
echo "folderName=`basename -s .jar dist/libs/runwar-*.jar | sed -e 's/runwar-//'`" >> $GITHUB_ENV | |
mkdir dist/libs/temp && cp dist/libs/runwar-*.jar dist/libs/temp | |
- name: Upload JAR to S3 | |
# Run the upload on master branch | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
AWS_S3_BUCKET: "downloads.ortussolutions.com" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} | |
SOURCE_DIR: "dist/libs/temp/" | |
DEST_DIR: "cfmlprojects/runwar/${{env.folderName}}" |