-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1ad3898
commit dd1fdab
Showing
2 changed files
with
97 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.16 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.16 | ||
|
||
# Build with gradle | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build |
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,70 @@ | ||
name: Release on tag | ||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- 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 }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Set output variables | ||
id: export_vars | ||
run: | | ||
export RELEASE_UPLOAD_URL="${{ steps.create_release.outputs.upload_url }}" | ||
echo "::set-output name=release_upload_url::${RELEASE_UPLOAD_URL}" | ||
outputs: | ||
release_upload_url: ${{ steps.export_vars.outputs.release_upload_url }} | ||
|
||
build-java-11: | ||
needs: create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
#Checkout | ||
- uses: actions/checkout@v2 | ||
|
||
#Setup Java 16 | ||
- name: Set up Java 16 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.16 | ||
|
||
#Apply permissions for Gradle, so that ./gradlew can run | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
#Build the JAR | ||
- name: Build with Gradle | ||
run: ./gradlew ghActions | ||
|
||
#Extract version number | ||
- name: Extract version number | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
#Extract repository name | ||
- name: Extract repository name | ||
run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" >> $GITHUB_ENV | ||
|
||
#Attach compiled JAR to ReleaseS | ||
- name: Attach JAR to Release | ||
id: upload_release_asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.release_upload_url }} | ||
asset_path: actions/output.jar | ||
asset_name: ${{ env.REPOSITORY_NAME }}-${{ env.RELEASE_VERSION }}-RELEASE.jar | ||
asset_content_type: application/java-archive |