Skip to content

Commit 9a40356

Browse files
authored
Merge pull request #4 from Together-Java/feature/cicd-workflows
CI/CD integration Merge current work even if it isn't finished
2 parents dce7a2d + c683789 commit 9a40356

17 files changed

Lines changed: 214 additions & 376 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Together-Java/moderators @Together-Java/maintainers
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Docker Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'feature/cicd-workflows'
8+
9+
env:
10+
JAVA_VERSION: 19
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up JDK
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: ${{ env.JAVA_VERSION }}
20+
- name: Extract branch name
21+
shell: bash
22+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
23+
id: extract_branch
24+
- uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
- name: Build and Publish Docker Image
28+
env:
29+
ORG_REGISTRY_USER: ${{ secrets.ORG_REGISTRY_USER }}
30+
ORG_REGISTRY_PASSWORD: ${{ secrets.ORG_REGISTRY_PASSWORD }}
31+
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
32+
run: ./gradlew jib
33+
- name: Re-Deploy
34+
run: "curl -H 'Authorization: Bearer ${{ secrets.ORG_WATCHTOWER_TOKEN }}' https://togetherjava.org:5003/v1/update"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Docker Verify
2+
3+
on: [pull_request]
4+
5+
env:
6+
JAVA_VERSION: 19
7+
8+
jobs:
9+
docker:
10+
name: Docker Verify
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up JDK
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: ${{ env.JAVA_VERSION }}
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Docker Verify
21+
run: ./gradlew jibDockerBuild

.github/workflows/releases.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release JAR
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
env:
13+
JAVA_VERSION: 19
14+
15+
jobs:
16+
17+
release:
18+
name: Build and release
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Set up JDK
22+
uses: actions/setup-java@v1
23+
with:
24+
java-version: ${{ env.JAVA_VERSION }}
25+
26+
- uses: actions/checkout@v2
27+
28+
- name: Build shadow jar
29+
run: ./gradlew shadowJar
30+
31+
- name: Create release
32+
uses: softprops/action-gh-release@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
files: app/build/libs/TJ-Plays.jar

JShellAPI/build.gradle

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
import org.gradle.jvm.toolchain.JavaLanguageVersion
2+
13
plugins {
24
id 'java'
35
id 'org.springframework.boot' version '3.0.1'
46
id 'io.spring.dependency-management' version '1.1.0'
7+
id 'com.google.cloud.tools.jib' version '3.3.2'
8+
id 'com.github.johnrengelman.shadow' version '8.1.1'
59
}
610

711
group 'org.togetherjava'
812
version '1.0-SNAPSHOT'
9-
sourceCompatibility = '19'
13+
14+
java {
15+
toolchain {
16+
languageVersion = JavaLanguageVersion.of(19)
17+
}
18+
}
1019

1120
repositories {
1221
mavenCentral()
@@ -19,6 +28,29 @@ dependencies {
1928
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
2029
}
2130

31+
var outputImage = 'togetherjava.org:5001/togetherjava/jshellbackend:master' ?: 'latest'
32+
33+
jib {
34+
from.image = 'eclipse-temurin:19'
35+
to {
36+
image = outputImage
37+
auth {
38+
username = System.getenv('ORG_REGISTRY_USER') ?: ''
39+
password = System.getenv('ORG_REGISTRY_PASSWORD') ?: ''
40+
}
41+
}
42+
container {
43+
mainClass = 'org.togetherjava.jshellapi.Main'
44+
setCreationTime(java.time.Instant.now().toString())
45+
}
46+
}
47+
48+
shadowJar {
49+
archiveBaseName.set('JShellPlaygroundBackend')
50+
archiveClassifier.set('')
51+
archiveVersion.set('')
52+
}
53+
2254
tasks.named('test') {
2355
useJUnitPlatform()
24-
}
56+
}

JShellAPI/gradlew

Lines changed: 0 additions & 234 deletions
This file was deleted.

0 commit comments

Comments
 (0)