-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
305 additions
and
162 deletions.
There are no files selected for viewing
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 file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # For v1.0, v0.1.0, etc | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest ] | ||
java: [ 11, 16 ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'zulu' | ||
|
||
- name: Grant execute permission for gradlew | ||
if: runner.os == 'Linux' | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build --info | ||
|
||
- name: Upload build results | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2.2.4 | ||
with: | ||
name: ${{ matrix.os }} Java ${{ matrix.java }} build results | ||
path: ${{ github.workspace }}/build/ | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
SPS_MVN_USER: ${{ secrets.SPS_MVN_USER }} | ||
SPS_MVN_PASS: ${{ secrets.SPS_MVN_PASS }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: 'zulu' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Publish with Gradle | ||
run: ./gradlew -Pver=${GITHUB_REF/refs\/tags\//} release | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2.2.4 | ||
with: | ||
name: Release Jar(s) | ||
path: ${{ github.workspace }}/build/libs/ | ||
|
||
- name: Draft GitHub 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 }} | ||
draft: true | ||
body: | | ||
# Recent Changes | ||
## Improvements 🏗️ | ||
* Item 1 | ||
## Bug Fixes 🐞 | ||
* Item 2 | ||
- name: Upload GitHub Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ github.workspace }}/build/libs/ExamplePlugin.jar | ||
asset_name: ExamplePlugin.jar | ||
asset_content_type: application/java-archive | ||
|
||
bump-version: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_PAT: ${{ secrets.PR_PAT }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Bump project version | ||
run: | | ||
cat ${{ github.workspace }}/version.txt \ | ||
| awk -F. -v OFS=. 'BEGIN { ORS="" }; NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", \ | ||
length ($NF), ($NF+1)); print}' \ | ||
| tee ${{ github.workspace }}/version.txt | ||
- name: Create Pull Request | ||
if: ${{ env.PR_PAT != null }} | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
assignees: leviem1 | ||
base: main | ||
body: Bumps the project's Gradle version in version.txt | ||
branch: bump-version | ||
commit-message: Bump project version | ||
delete-branch: true | ||
labels: enhancement, low priority | ||
title: Bump project version | ||
token: ${{ secrets.PR_PAT }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Build Snapshot | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest ] | ||
java: [ 11, 16 ] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'zulu' | ||
|
||
- name: Grant execute permission for gradlew | ||
if: runner.os == 'Linux' | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build --info | ||
|
||
- name: Upload build results | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2.2.4 | ||
with: | ||
name: ${{ matrix.os }} Java ${{ matrix.java }} build results | ||
path: ${{ github.workspace }}/build/ | ||
|
||
artifact: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: 'zulu' | ||
|
||
- name: Grant execute permission for gradlew | ||
if: runner.os == 'Linux' | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build --info | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2.2.4 | ||
with: | ||
name: Snapshot Jar(s) | ||
path: ${{ github.workspace }}/build/libs/ | ||
|
||
notify: | ||
needs: artifact | ||
runs-on: ubuntu-latest | ||
env: | ||
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }} | ||
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | ||
if: ${{ always() }} | ||
steps: | ||
- name: Notify on success | ||
if: ${{ env.DISCORD_WEBHOOK_ID != null && env.DISCORD_WEBHOOK_TOKEN != null && needs.artifact.result == 'success' }} | ||
uses: appleboy/discord-action@0.0.3 | ||
with: | ||
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | ||
color: "#00FF00" | ||
username: "CW Build Status Bot" | ||
message: > | ||
${{ github.repository }} build ${{ github.run_number }} successfully completed: | ||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- name: Notify on failure | ||
if: ${{ env.DISCORD_WEBHOOK_ID != null && env.DISCORD_WEBHOOK_TOKEN != null && needs.artifact.result == 'failure' }} | ||
uses: appleboy/discord-action@0.0.3 | ||
with: | ||
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | ||
color: "#FF0000" | ||
username: "CW Build Status Bot" | ||
message: > | ||
${{ github.repository }} build ${{ github.run_number }} failed: | ||
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
Oops, something went wrong.