-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Took 17 seconds
- Loading branch information
Showing
1 changed file
with
71 additions
and
14 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 |
---|---|---|
@@ -1,26 +1,83 @@ | ||
name: Skulls Build | ||
#name: Skulls Build | ||
# | ||
#on: [ push, pull_request ] | ||
# | ||
#jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout the repository | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Set up JDK 16 | ||
# uses: actions/setup-java@v2 | ||
# with: | ||
# distribution: 'temurin' | ||
# java-version: '16' | ||
# | ||
# - name: Cache Maven Packages | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: ~/.m2 | ||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2 | ||
# | ||
# - name: Build with Maven | ||
# run: mvn verify -B --file pom.xml | ||
|
||
on: [ push, pull_request ] | ||
|
||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 16 | ||
uses: actions/setup-java@v2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '16' | ||
distribution: 'adopt' | ||
|
||
- name: Build with Maven | ||
run: mvn clean package | ||
|
||
- name: Cache Maven Packages | ||
uses: actions/cache@v2 | ||
- name: Get version | ||
id: get_version | ||
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT | ||
|
||
- name: Check if release exists | ||
id: check_release | ||
run: | | ||
RELEASE_EXISTS=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ steps.get_version.outputs.VERSION }}) | ||
echo "EXISTS=$RELEASE_EXISTS" >> $GITHUB_OUTPUT | ||
- name: Create Release | ||
if: steps.check_release.outputs.EXISTS != '200' | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
tag_name: v${{ steps.get_version.outputs.VERSION }} | ||
release_name: Release v${{ steps.get_version.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Build with Maven | ||
run: mvn verify -B --file pom.xml | ||
- name: Upload Release Asset | ||
if: steps.check_release.outputs.EXISTS != '200' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./target/Skulls-${{ steps.get_version.outputs.VERSION }}.jar | ||
asset_name: Skulls-${{ steps.get_version.outputs.VERSION }}.jar | ||
asset_content_type: application/java-archive |