ExtremeDemonList/.github/workflows/maven.yml
2024-03-03 13:58:47 +01:00

46 lines
1.2 KiB
YAML

name: Java CI with Maven and Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: |
mvn -B package --file pom.xml
mkdir -p target
- name: Extract artifact
run: unzip target/*.zip -d target/artifact
- name: Get current timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
- name: Create directory with run ID
run: mkdir -p ${{ github.workspace }}/target/artifact_${{ steps.timestamp.outputs.timestamp }}
- name: Move artifact to directory with run ID
run: mv target/artifact/* ${{ github.workspace }}/target/artifact_${{ steps.timestamp.outputs.timestamp }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: artifact_${{ steps.timestamp.outputs.timestamp }}
path: ${{ github.workspace }}/target/artifact_${{ steps.timestamp.outputs.timestamp }}