mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 02:57:41 +00:00
2.0
This commit is contained in:
69
.github/workflows/gradle.yml
vendored
Normal file
69
.github/workflows/gradle.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: Build Plugin
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- run: |
|
||||
gradle wrapper
|
||||
chmod +x ./gradlew
|
||||
./gradlew shadowJar
|
||||
|
||||
- id: vars
|
||||
run: |
|
||||
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
||||
./gradlew -q printVars | sed 's/ = /=/g' >> "$GITHUB_OUTPUT"
|
||||
|
||||
- id: ghck
|
||||
run: |
|
||||
CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ steps.vars.outputs.VERS }}")
|
||||
if [ "$CODE" = "200" ]; then
|
||||
echo "EXISTS=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "EXISTS=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- run: |
|
||||
mkdir -p dist
|
||||
cp "./build/libs/${{ steps.vars.outputs.AFCT }}" ./dist
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: dist/${{ steps.vars.outputs.AFCT }}
|
||||
name: ${{ steps.vars.outputs.AFCT }}
|
||||
|
||||
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ format('v{0}{1}', steps.vars.outputs.VERS, steps.ghck.outputs.EXISTS == 'true' && format('+{0}', steps.vars.outputs.COMMIT_HASH) || '') }}
|
||||
name: ${{ format('{0}{1}', steps.ghck.outputs.EXISTS == 'true' && 'Snapshot ' || 'v', steps.ghck.outputs.EXISTS == 'true' && steps.vars.outputs.COMMIT_HASH || steps.vars.outputs.VERS) }}
|
||||
files: dist/${{ steps.vars.outputs.AFCT }}
|
||||
prerelease: ${{ steps.ghck.outputs.EXISTS == 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user