Skip to content

Commit

Permalink
🚑 Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
boul2gom committed Mar 21, 2022
1 parent 7597833 commit 84fb014
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 9 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Github CI - Development

on:
push:
branches: [develop]

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

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'

- name: Build with Gradle
run: gradle build
env:
RELEASE_TYPE: "develop"

MAVEN_USERNAME: ${{ github.actor }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: YggTools
path: |
Redis/build/libs/
Tools/build/libs/
- name: Upload doc artifacts
uses: actions/upload-artifact@v3
with:
name: YggTools-Doc
path: |
Redis/build/docs/
Tools/build/docs/
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: YggTools

- name: Publish to Maven Repository
run: gradle publish
env:
RELEASE_TYPE: "develop"

MAVEN_USERNAME: ${{ github.actor }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}

GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml → .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Github CI
name: Github CI - Production

on:
push:
branches: [master, develop]
branches: [master]

jobs:
build:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Build with Gradle
run: gradle build
env:
RELEASE_TYPE: ${{ github.ref_name }}
RELEASE_TYPE: "releases"

MAVEN_USERNAME: ${{ github.actor }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
- name: Publish to Maven Repository
run: gradle publish
env:
RELEASE_TYPE: ${{ github.ref_name }}
RELEASE_TYPE: "releases"

MAVEN_USERNAME: ${{ github.actor }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}
Expand Down
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ subprojects {
version = '1.1.1'
group = 'io.github.yggdrasil80'

def development = !(System.getenv("RELEASE_TYPE") != null && System.getenv("RELEASE_TYPE").equalsIgnoreCase("master"))
def development = !(System.getenv("RELEASE_TYPE") != null && System.getenv("RELEASE_TYPE").equalsIgnoreCase("releases"))
def artifact = rootProject.name.toLowerCase() + (!(project.name == "Tools") ? "-" + project.name.toLowerCase() : "")
def repository = !development ? "release" : "develop"
def branch = !development ? "master" : "develop"

java {
toolchain {
Expand Down Expand Up @@ -83,15 +81,15 @@ subprojects {
scm {
connection = 'scm:git:github.com/Yggdrasil80/YggTools.git'
developerConnection = 'scm:git:ssh://github.com/Yggdrasil80/YggTools.git'
url = 'https://github.com/Yggdrasil80/YggTools/tree/' + branch
url = 'https://github.com/Yggdrasil80/YggTools/tree/' + System.getenv("RELEASE_TYPE")
}
}
}
}

repositories {
maven {
url = "https://repo.yggdrasil80.tech/" + repository + "/"
url = "https://repo.yggdrasil80.tech/" + System.getenv("RELEASE_TYPE") + "/"

credentials {
username = System.getenv("MAVEN_USERNAME")
Expand Down

0 comments on commit 84fb014

Please sign in to comment.