diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..52b7e8c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: ["https://afdian.com/a/17TheWord"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c46bb0b..f443694 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build Plugin and Mod on: + push: + branches: + - main workflow_dispatch: permissions: @@ -10,45 +13,6 @@ env: GH_TOKEN: ${{ github.token }} jobs: - create-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Read version.txt and save to variable - shell: pwsh - run: | - $mod_version = Get-Content version.txt - Write-Host "Version: $mod_version" - echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV - - - name: Check if Release exists - id: check-release - run: | - # Check if the release exists - RESPONSE=$(gh release view v${{ env.MOD_VERSION }} -R ${{ github.repository }} 2>&1 || true) - if echo "$RESPONSE" | grep -q "Not Found"; then - echo "Release v${{ env.MOD_VERSION }} does not exist. Skipping deletion." - echo "RELEASE_EXISTS=false" >> $GITHUB_ENV - else - echo "Release v${{ env.MOD_VERSION }} exists." - echo "RELEASE_EXISTS=true" >> $GITHUB_ENV - fi - - - name: Delete Release if exists - if: env.RELEASE_EXISTS == 'true' - run: | - # Try to delete the release and handle errors gracefully - set +e - gh release delete v${{ env.MOD_VERSION }} -R ${{ github.repository }} -y --cleanup-tag - if [ $? -eq 0 ]; then - echo "Release v${{ env.MOD_VERSION }} deleted successfully." - else - echo "Failed to delete release v${{ env.MOD_VERSION }}. It might not exist or there might be another issue." - fi - - - name: Create Release with temp note - run: gh release create v${{ env.MOD_VERSION }} --generate-notes - generate-matrix: runs-on: windows-latest outputs: @@ -59,12 +23,11 @@ jobs: id: set-matrix shell: pwsh run: | - .\matrix.ps1 -path "fabric","forge","spigot" + .\matrix.ps1 -path "fabric","forge","spigot","velocity" build: runs-on: windows-latest needs: - - create-release - generate-matrix strategy: matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} @@ -103,5 +66,6 @@ jobs: path: QueQiao-jar/${{ env.MOD_VERSION }}/QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar - name: Upload to Release + if: ${{ github.event_name == 'push' }} run: | gh release upload v${{ env.MOD_VERSION }} QueQiao-jar/${{ env.MOD_VERSION }}/QueQiao-${{ matrix.config.mc-loader }}+${{ matrix.config.mc-version }}-${{ env.MOD_VERSION }}.jar \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7a7195 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Create Release + +on: + push: + branches: + - main + +permissions: + contents: write + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Read version.txt and save to variable + shell: pwsh + run: | + $mod_version = Get-Content version.txt + Write-Host "Version: $mod_version" + echo "MOD_VERSION=$mod_version" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_ENV + + - name: Check if Release exists + id: check-release + run: | + # Check if the release exists + RESPONSE=$(gh release view v${{ env.MOD_VERSION }} -R ${{ github.repository }} 2>&1 || true) + if echo "$RESPONSE" | grep -q "Not Found"; then + echo "Release v${{ env.MOD_VERSION }} does not exist. Skipping deletion." + echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + else + echo "Release v${{ env.MOD_VERSION }} exists." + echo "RELEASE_EXISTS=true" >> $GITHUB_ENV + fi + + - name: Delete Release if exists + run: | + # Try to delete the release and handle errors gracefully + set +e + gh release delete v${{ env.MOD_VERSION }} -R ${{ github.repository }} -y --cleanup-tag + if [ $? -eq 0 ]; then + echo "Release v${{ env.MOD_VERSION }} deleted successfully." + else + echo "Failed to delete release v${{ env.MOD_VERSION }}. It might not exist or there might be another issue." + fi + + - name: Create Release with temp note + run: gh release create v${{ env.MOD_VERSION }} --generate-notes \ No newline at end of file diff --git a/.gitignore b/.gitignore index c359a87..d9bda3e 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,8 @@ velocity/velocity-*/ !velocity/velocity-*/gradlew !velocity/velocity-*/gradlew.bat +!velocity/velocity-*/build/generated/sources/tamplates/ + !tool/ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml diff --git a/.idea/ModMultiLoaders.xml b/.idea/ModMultiLoaders.xml index b6f561f..2a419f1 100644 --- a/.idea/ModMultiLoaders.xml +++ b/.idea/ModMultiLoaders.xml @@ -8,6 +8,7 @@ diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 77f1f1d..ad9d3ed 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -4,15 +4,10 @@ - @@ -33,6 +28,8 @@ + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index af924a8..4bd2044 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -103,6 +103,14 @@ + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index f4abeec..5a9e971 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -126,5 +126,10 @@