Skip to content

Commit

Permalink
test build
Browse files Browse the repository at this point in the history
Took 17 seconds
  • Loading branch information
kiranhart committed Jan 20, 2025
1 parent 248ba19 commit 5f08518
Showing 1 changed file with 71 additions and 14 deletions.
85 changes: 71 additions & 14 deletions .github/workflows/build.yml
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

0 comments on commit 5f08518

Please sign in to comment.