-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from StartsMercury/add-gh-actions
Add GH actions
- Loading branch information
Showing
4 changed files
with
153 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,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 |
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,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 |
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,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 |
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,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 |