2020-11-26 16:05:45 +00:00
|
|
|
name: OpenInv CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
create:
|
|
|
|
types: [tag]
|
|
|
|
pull_request_target:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set Up Java
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
|
|
|
java-version: 1.8
|
|
|
|
|
|
|
|
# Use cache to speed up build
|
|
|
|
- name: Cache Maven Repo
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: ~/.m2/repository
|
|
|
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
|
|
|
2021-03-16 13:45:04 +00:00
|
|
|
# Install Spigot dependencies.
|
|
|
|
# This script uses Maven to check all required installations and ensure that they are present.
|
2020-11-26 16:05:45 +00:00
|
|
|
- name: Install Spigot Dependencies
|
2021-03-16 13:45:04 +00:00
|
|
|
run: . scripts/install_spigot_dependencies.sh
|
2020-11-26 16:05:45 +00:00
|
|
|
|
|
|
|
- name: Build With Maven
|
|
|
|
run: mvn -e clean package -am -P all
|
|
|
|
|
|
|
|
# Upload artifacts
|
|
|
|
- name: Upload Distributable Jar
|
|
|
|
id: upload-final
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: ./target/OpenInv.jar
|
|
|
|
- name: Upload API Jar
|
|
|
|
id: upload-api
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: api
|
|
|
|
path: ./api/target/openinvapi*.jar
|
|
|
|
|
|
|
|
release:
|
|
|
|
name: Create Github Release
|
|
|
|
needs: [ build ]
|
|
|
|
if: github.event_name == 'create' && github.event.ref_type == 'tag'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Download Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
|
2021-03-18 20:38:41 +00:00
|
|
|
- name: Generate changelog
|
|
|
|
run: . scripts/generate_changelog.sh
|
|
|
|
|
2020-11-26 16:05:45 +00:00
|
|
|
- name: Create Release
|
|
|
|
id: create-release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: Release ${{ github.ref }}
|
2021-03-18 20:38:41 +00:00
|
|
|
body: ${{ env.GENERATED_CHANGELOG }}
|
2020-11-26 16:05:45 +00:00
|
|
|
draft: true
|
|
|
|
prerelease: false
|
|
|
|
|
|
|
|
- name: Upload Release Asset
|
|
|
|
id: upload-release-asset
|
|
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
|
|
asset_path: ./OpenInv.jar
|
|
|
|
asset_name: OpenInv.jar
|
|
|
|
asset_content_type: application/java-archive
|