Manual Release #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Manual Release | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Get version from gradle.properties | |
| id: project_version | |
| run: echo "version=$(grep '^version=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT | |
| - name: Package artifacts | |
| run: ./gradlew package | |
| - name: Delete existing tag if exists | |
| run: | | |
| VERSION=${{ steps.project_version.outputs.version }} | |
| git tag -d "v${VERSION}" 2>/dev/null || true | |
| git push origin ":refs/tags/v${VERSION}" 2>/dev/null || true | |
| continue-on-error: true | |
| - name: Create and push tag | |
| run: | | |
| VERSION=${{ steps.project_version.outputs.version }} | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git tag "v${VERSION}" | |
| git push origin "v${VERSION}" | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.project_version.outputs.version }} | |
| name: FGateClient v${{ steps.project_version.outputs.version }} | |
| draft: false | |
| generate_release_notes: true | |
| prerelease: false | |
| files: outputs/*.jar | |
| body: | | |
| ## FGateClient v${{ steps.project_version.outputs.version }} | |
| **发布时间:** ${{ steps.date.outputs.date }} |