80 lines
1.8 KiB
YAML
80 lines
1.8 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 'Set up JDK'
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'adopt'
|
|
cache: 'gradle'
|
|
|
|
- name: 'Build'
|
|
run: ./gradlew build --no-daemon
|
|
|
|
- name: 'Upload artifact'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: MobArena.jar
|
|
path: build/libs/MobArena-*.jar
|
|
|
|
- name: 'Output version'
|
|
id: version
|
|
run: |
|
|
version=$(
|
|
unzip -p build/libs/MobArena-*.jar plugin.yml \
|
|
| grep '^version: ' \
|
|
| awk '{printf $2}' \
|
|
| tr -d "'" \
|
|
)
|
|
echo "version=${version}" >> "${GITHUB_OUTPUT}"
|
|
|
|
draft:
|
|
needs: build
|
|
|
|
if: |
|
|
needs.build.result == 'success' &&
|
|
github.ref_name == 'master' &&
|
|
startsWith(github.event.head_commit.message, 'Release ') &&
|
|
!endsWith(needs.build.outputs.version, '-SNAPSHOT')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
VERSION: ${{ needs.build.outputs.version }}
|
|
|
|
steps:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 'Download artifact'
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: MobArena.jar
|
|
|
|
- name: 'Extract release notes'
|
|
run: scripts/extract-release-notes -f github "${VERSION}" > release-notes.md
|
|
|
|
- name: 'Create release draft'
|
|
run: gh release create "${VERSION}" --draft --notes-file release-notes.md MobArena-*.jar
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|