Skip to content

Commit

Permalink
Merge pull request #5 from StartsMercury/add-gh-actions
Browse files Browse the repository at this point in the history
Add GH actions
  • Loading branch information
TheEntropyShard authored Jan 19, 2025
2 parents 9c08b10 + 2f3508a commit 4118e7f
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build-commit
on: [ push ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Gradle Build
run: ./gradlew check build

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: versionsgen-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
29 changes: 29 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build-pull-request
on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Gradle Build
run: ./gradlew check build
39 changes: 39 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build-release
on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Build
run: ./gradlew clean check build

- name: Upload Binaries to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/*.jar
file_glob: true
44 changes: 44 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-tag
on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract Current Branch Name
shell: bash
# bash pattern expansion to grab the branch name without the slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref

- name: Checkout Repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Make Gradle Wrapper Executable
run: chmod +x ./gradlew

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Gradle Build
run: ./gradlew clean check build

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: versionsgen-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar

0 comments on commit 4118e7f

Please sign in to comment.