Skip to content

Commit

Permalink
dist java
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Nov 3, 2024
1 parent 679573b commit 572f555
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build, Test, and Deploy

on:
push:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"


- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven

- name: Build and test with Maven
run: mvn clean install --batch-mode

deploy:
runs-on: ubuntu-latest
needs: build-and-test
if: success()

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
FILE_PATH=$(find target -name "*.jar" | head -n 1)
if [ -z "$FILE_PATH" ]; then
echo "Artifact not found!" && exit 1
fi
S3_URI="s3://your-bucket-name/maven-repo/path/to/artifact/"
aws s3 cp "$FILE_PATH" "$S3_URI"
- name: Verify artifact upload
run: |
aws s3 ls s3://your-bucket-name/maven-repo/path/to/artifact/

0 comments on commit 572f555

Please sign in to comment.