fix some logic #19
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: Build Plugin | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Build Jar | |
| run: | | |
| gradle wrapper | |
| ./gradlew shadowJar | |
| - name: Publish Jar | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: OriginBlacklist | |
| path: build/libs/OriginBlacklist.jar | |
| - name: Extract Version | |
| id: version | |
| run: | | |
| VERSION=$(grep "^version" build.gradle | head -n 1 | cut -d\' -f2) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Remove Existing Release | |
| run: | | |
| gh release delete v${{ steps.version.outputs.version }} -y || true | |
| git push origin :refs/tags/v${{ steps.version.outputs.version }} || true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-release-asset@v1.0.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/libs/OriginBlacklist.jar | |
| asset_name: OriginBlacklist_${{ steps.version.outputs.version }}.jar | |
| asset_content_type: application/java-archive | |
| - uses: eregon/publish-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| release_id: ${{ steps.create_release.outputs.id }} |