udpates createSpace method to check for existence of space before try… #47
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
# Continuous Integration Build via GitHub Actions | |
name: CI Build | |
# Run this Build for all pushes and PRs | |
on: [push, pull_request] | |
jobs: | |
ci-build: | |
runs-on: ubuntu-latest | |
env: | |
# Specify memory for Maven | |
MAVEN_OPTS: "-Xmx256M" | |
steps: | |
# Output current build environment | |
- run: echo "This is a CI build of branch ${{ github.ref }} in repository ${{ github.repository }}" | |
- run: echo "This job was triggered by a ${{ github.event_name }} event and is running on a ${{ runner.os }} server" | |
# https://github.com/actions/checkout | |
- name: Checkout codebase | |
uses: actions/checkout@v2 | |
# https://github.com/actions/setup-java | |
- name: Install JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: adopt | |
# https://github.com/actions/cache | |
- name: Cache Maven dependencies | |
uses: actions/cache@v2 | |
with: | |
# Cache entire ~/.m2/repository | |
path: ~/.m2/repository | |
# Cache key is hash of all pom.xml files. Therefore any changes to POMs will invalidate cache | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-maven- | |
# Run build and execute tests | |
- name: Build and Run unit tests | |
run: mvn clean install -DskipIntTests -DskipDeploy --batch-mode | |
# https://github.com/actions/setup-java | |
# Sets up Java again, preparing the settings.xml to deploy to Sonatype (Maven) | |
# ONLY on push to develop branch (using Sonatype snapshots repo) | |
- name: Set up for deploy to Sonatype | |
uses: actions/setup-java@v2 | |
if: github.ref == 'refs/heads/develop' && github.event_name == 'push' | |
with: | |
java-version: 17 | |
distribution: adopt | |
server-id: sonatype-snapshots # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: SONATYPE_USERNAME # env variable for sonatype username | |
server-password: SONATYPE_PASSWORD # env variable for sonatype password | |
gpg-private-key: ${{ secrets.CODESIGN_GPG_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: CODESIGN_GPG_PASSPHRASE # env variable for GPG private key passphrase | |
# ONLY on push to main branch (using Sonatype releases repo) | |
- name: Set up for deploy to Sonatype | |
uses: actions/setup-java@v2 | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
with: | |
java-version: 17 | |
distribution: adopt | |
server-id: sonatype-releases # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: SONATYPE_USERNAME # env variable for sonatype username | |
server-password: SONATYPE_PASSWORD # env variable for sonatype password | |
gpg-private-key: ${{ secrets.CODESIGN_GPG_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: CODESIGN_GPG_PASSPHRASE # env variable for GPG private key passphrase | |
# Execute deployment to sonatype (only on push to develop or main branches) | |
- name: Publish to Sonatype | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') | |
run: mvn deploy -DreleaseBuild -DskipTests -DskipDeploy --batch-mode | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
CODESIGN_GPG_PASSPHRASE: ${{ secrets.CODESIGN_GPG_PASSPHRASE }} | |
- name: Create Derivatives | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') | |
env: | |
BITROCK_INSTALLBUILDER_LICENSE: ${{ secrets.BITROCK_INSTALLBUILDER_LICENSE}} | |
CODESIGN_GPG_PASSPHRASE: ${{ secrets.CODESIGN_GPG_PASSPHRASE }} | |
run: | | |
./resources/github/install-bitrock.sh | |
./resources/github/create-package.sh | |
- name: Configure AWS | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Upload to S3 | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') | |
env: | |
S3_BUCKET: ${{ secrets.DURACLOUD_ARTIFACT_S3_BUCKET}} | |
run: | | |
projectVersion=`mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec` | |
s3Path=s3://${S3_BUCKET}/duracloud/${GITHUB_REF##*/}/$projectVersion/ | |
cd ./target | |
aws s3 cp ./ ${s3Path} --recursive |