Updated github action. #11
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 will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Environment | |
run: | | |
echo GITHUB_WORKSPACE $GITHUB_WORKSPACE | |
echo GITHUB_REF $GITHUB_REF | |
echo GITHUB_SHA $GITHUB_SHA | |
echo GITHUB_EVENT_NAME $GITHUB_EVENT_NAME | |
- uses: actions/checkout@v4.1.1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4.2.0 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- uses: actions/cache@v4.0.1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
- name: Build with Maven | |
run: mvn clean verify -e -Dgpg.skip=true -Dmaven.wagon.provider.http=httpclient -Dmaven.artifact.threads=12 -Dhttp.tcp.nodelay=false | |
- name: Prepare deploy local directory | |
id: prepare_deploy | |
run: | | |
chmod a+x prepare-deploy-local-dir.sh | |
export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)" | |
if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi | |
./prepare-deploy-local-dir.sh $GITHUB_WORKSPACE/$TAG_OR_BRANCH | |
echo "TAG_OR_BRANCH=${TAG_OR_BRANCH}" >> $GITHUB_OUTPUT | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "eu-west-1" | |
SOURCE_DIR: ${{ steps.prepare_deploy.outputs.TAG_OR_BRANCH }} | |
DEST_DIR: bits/${{ steps.prepare_deploy.outputs.TAG_OR_BRANCH }} | |