45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Auto Release
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
|
|
- name: Build with Maven
|
|
run: mvn -B clean package -DskipTests
|
|
|
|
- name: Get version info
|
|
id: version
|
|
run: |
|
|
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
|
|
TIMESTAMP=$(date -u '+%Y%m%d-%H%M%S')
|
|
echo "tag=build-${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT
|
|
echo "name=Build ${TIMESTAMP} (${SHORT_SHA})" >> $GITHUB_OUTPUT
|
|
|
|
- name: Delete old build tag if exists
|
|
continue-on-error: true
|
|
run: git push --delete origin ${{ steps.version.outputs.tag }} 2>/dev/null || true
|
|
|
|
- name: Create Release with JAR
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.tag }}
|
|
name: ${{ steps.version.outputs.name }}
|
|
files: target/Sdf1_login.jar
|
|
generate_release_notes: true
|
|
make_latest: true
|