修复自动Release工作流:GitHub用标准action,Gitea用专用release-action
Auto Release / build-and-release (push) Has been cancelled

This commit is contained in:
2026-07-18 21:49:03 +08:00
parent 996fd41d8a
commit 104286a66e
2 changed files with 25 additions and 33 deletions
+6 -18
View File
@@ -22,23 +22,11 @@ jobs:
- 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
uses: gitea.com/actions/release-action@main
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.name }}
files: target/Sdf1_login.jar
generate_release_notes: true
make_latest: true
tag_name: build-${{ gitea.run_number }}
name: Build #${{ gitea.run_number }}
files: |
target/Sdf1_login.jar
token: ${{ secrets.GITEA_TOKEN }}
+19 -15
View File
@@ -22,23 +22,27 @@ jobs:
- 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: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: Sdf1_login
path: target/Sdf1_login.jar
- name: Delete old build tag if exists
continue-on-error: true
run: git push --delete origin ${{ steps.version.outputs.tag }} 2>/dev/null || true
release:
needs: build-and-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download JAR artifact
uses: actions/download-artifact@v4
with:
name: Sdf1_login
- name: Create Release with JAR
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ${{ steps.version.outputs.name }}
files: target/Sdf1_login.jar
tag_name: build-${{ github.run_number }}
name: Build #${{ github.run_number }}
files: Sdf1_login.jar
generate_release_notes: true
make_latest: true