Skip to content

1.4.1-beta5.6

1.4.1-beta5.6 #48

Workflow file for this run

name: Build and Release
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag_name:
description: '对应Release tag名字(例:1.4.2)'
required: true
default: ''
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Build with Maven
run: mvn -B clean package --file pom.xml -DskipTests
- name: Rename WAR file
run: |
cd target
if [ "${{ github.event_name }}" = "release" ]; then
TAG_NAME="${{ github.event.release.tag_name }}"
else
TAG_NAME="${{ github.event.inputs.tag_name }}"
fi
for file in *.war; do
if [ -f "$file" ]; then
mv "$file" "biliupforjava-${TAG_NAME}.war"
echo "Renamed: $file -> biliupforjava-${TAG_NAME}.war"
fi
done
ls -la *.war
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Looking for WAR files in target/"
ls -la target/*.war || true
if [ "${{ github.event_name }}" = "release" ]; then
TAG_NAME="${{ github.event.release.tag_name }}"
else
TAG_NAME="${{ github.event.inputs.tag_name }}"
fi
ARTIFACT="target/biliupforjava-${TAG_NAME}.war"
if [ ! -f "$ARTIFACT" ]; then
echo "ERROR: Expected WAR file not found: $ARTIFACT"
ls -la target
exit 1
fi
echo "Uploading release asset: $ARTIFACT to tag: $TAG_NAME"
gh release upload "$TAG_NAME" "$ARTIFACT" --clobber