Skip to content

Commit

Permalink
GH Actions: for commit and pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
StartsMercury committed Oct 20, 2024
1 parent d6f78b9 commit 8576c59
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 86 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/CRMM_UPLOAD_RELEASE.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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@v3

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

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false

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

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: FluxApi-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
30 changes: 30 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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@v3

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

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true

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

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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@v3

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

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true

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

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

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: ./gradlew publishAllPublicationsToCRMReleasesRepository
env:
CRMReleasesUsername: ${{ secrets.CRM_GITHUB_USER }}
CRMReleasesPassword: ${{ secrets.CRM_GITHUB_PASS }}
45 changes: 45 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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@v3

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

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true

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

- name: Capture Build Artifacts
uses: actions/upload-artifact@v4
with:
name: FluxApi-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
42 changes: 0 additions & 42 deletions .github/workflows/gradle-publish.ymlx

This file was deleted.

0 comments on commit 8576c59

Please sign in to comment.