This repository has been archived by the owner on May 14, 2024. It is now read-only.
#116 Added support for 1.20.4. #143
This file contains 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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master, development ] | |
pull_request: | |
branches: [ master, development ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
Build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '17' | |
- name: Cache Spigot Dependencies | |
id: cache-spigot-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: /home/runner/.m2/repository/org/spigotmc | |
key: spigot-dependency | |
- name: Validate Spigot Dependencies | |
run: | | |
test -f ~/.m2/repository/org/spigotmc/spigot/1.19-R0.1-SNAPSHOT/spigot-1.19-R0.1-SNAPSHOT.jar && echo "DEPENDENCIES=true" >> $GITHUB_ENV || echo "DEPENDENCIES=false" >> $GITHUB_ENV | |
- name: Build Spigot Dependencies | |
if: ${{ env.DEPENDENCIES != 'true' }} | |
run: | | |
mkdir -p ~/.m2/repository/org/spigotmc/ | |
docker build --target dependencies-jdk8 -t structureblocklib-dependencies-jdk8 . | |
docker create --name structureblocklib-dependencies-jdk8 structureblocklib-dependencies-jdk8 bash | |
docker cp structureblocklib-dependencies-jdk8:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/ | |
docker rm -f structureblocklib-dependencies-jdk8 | |
docker build --target dependencies-jdk17 -t structureblocklib-dependencies-jdk17 . | |
docker create --name structureblocklib-dependencies-jdk17 structureblocklib-dependencies-jdk17 bash | |
docker cp structureblocklib-dependencies-jdk17:/root/.m2/repository/org/spigotmc ~/.m2/repository/org/ | |
docker rm -f structureblocklib-dependencies-jdk17 | |
- name: Build Java Application | |
run: | | |
chmod +x gradlew | |
./gradlew build pluginJar | |
- name: Publish Test Report | |
run: | | |
./gradlew jacocoTestReport | |
bash <(curl -s https://codecov.io/bash) | |
- name: Publish Release to Maven Central | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
env: | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_KEY_FILE: ${{ secrets.SIGNING_KEY_FILE }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
gpg2 --batch --cipher-algo AES256 --passphrase ${{ secrets.SIGNING_KEY_PASSWORD }} travis_secret_key.gpg | |
echo "RELEASE_VERSION=$(./gradlew -q printVersion)" >> $GITHUB_ENV | |
./gradlew publishToNexus | |
./gradlew closeAndReleaseRepository | |
./gradlew clean | |
./gradlew pluginJar | |
- name: Publish Snapshot | |
if: "contains(github.event.head_commit.message, '--snapshot')" | |
env: | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_KEY_FILE: ${{ secrets.SIGNING_KEY_FILE }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
gpg2 --batch --cipher-algo AES256 --passphrase ${{ secrets.SIGNING_KEY_PASSWORD }} travis_secret_key.gpg | |
./gradlew publish | |
- name: Create Github Release | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body: "This release was automatically created by Github Actions. Please wait until the author manually sets the patchnotes for this release." | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: Release ${{ env.RELEASE_VERSION }} | |
draft: false | |
prerelease: false | |
- name: Upload Bukkit Api to Github | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/work/StructureBlockLib/StructureBlockLib/structureblocklib-bukkit-api/build/libs/structureblocklib-bukkit-api-${{ env.RELEASE_VERSION }}.jar | |
asset_name: StructureBlockLib-Bukkit-Api.jar | |
asset_content_type: application/jar | |
- name: Upload Bukkit Core to Github | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/work/StructureBlockLib/StructureBlockLib/structureblocklib-bukkit-core/build/libs/structureblocklib-bukkit-core-${{ env.RELEASE_VERSION }}.jar | |
asset_name: StructureBlockLib-Bukkit-Core.jar | |
asset_content_type: application/jar | |
- name: Upload Bukkit Plugin to Github | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/work/StructureBlockLib/StructureBlockLib/structureblocklib-bukkit-plugin/build/libs/structureblocklib-bukkit-plugin-${{ env.RELEASE_VERSION }}.jar | |
asset_name: StructureBlockLib.jar | |
asset_content_type: application/jar | |
- name: Upload Bukkit Sampe Plugin to Github | |
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'master')" | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /home/runner/work/StructureBlockLib/StructureBlockLib/structureblocklib-bukkit-sample/build/libs/structureblocklib-bukkit-sample-${{ env.RELEASE_VERSION }}.jar | |
asset_name: StructureBlockLib-Bukkit-Plugin-Sample.jar | |
asset_content_type: application/jar | |
Documentation: | |
runs-on: ubuntu-latest | |
if: "contains(github.ref, 'master')" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '8' | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Build Documentation | |
run: | | |
git pull | |
git config --global user.email "[email protected]" && git config --global user.name "Shynixn CI Actions" | |
rm -rf docs/apidocs | |
mkdir -p docs/apidocs | |
chmod +x gradlew | |
./gradlew generateJavaDocPages | |
git add docs | |
git commit --message "Automatic CI Documentation." || echo "Documentation up to date." | |
git push --quiet https://Shynixn:${{ secrets.GITHUB_TOKEN }}@github.com/Shynixn/StructureBlockLib.git HEAD:master || echo "Documentation up to date." |