Skip to content

Commit fa935b1

Browse files
update ci to java 24 and jib native push to ghcr
1 parent ccc56d2 commit fa935b1

File tree

6 files changed

+67
-71
lines changed

6 files changed

+67
-71
lines changed

.github/workflows/cd.yaml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,66 @@
11
name: Build Image
22
on:
33
push:
4-
branches: [ 'master' ]
5-
tags: [ '*' ]
4+
branches: ['develop']
5+
tags: ['*']
66

77
jobs:
88
build-and-deploy-server:
9-
if: "startsWith(github.ref, 'refs/tags/')" # Deploy a new server version when a new tag is pushed
9+
if: startsWith(github.ref, 'refs/tags/')
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
1114
steps:
1215
- uses: actions/checkout@v4
1316
with:
1417
lfs: true
18+
submodules: recursive
1519
- run: git lfs checkout
1620
- uses: actions/setup-java@v4
1721
with:
18-
java-version: '23'
22+
java-version: '24'
1923
distribution: temurin
2024
- uses: actions/setup-node@v4
2125
with:
2226
node-version: 22
23-
- uses: actions/setup-dotnet@v4
24-
with:
25-
dotnet-version: |
26-
6.x.x
2727
- uses: gradle/actions/wrapper-validation@v3
2828
- name: Test with Gradle
2929
run: ./gradlew --no-parallel test
30-
- name: Log in to the Container registry
31-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
32-
with:
33-
registry: ghcr.io
34-
username: ${{ github.actor }}
35-
password: ${{ secrets.GITHUB_TOKEN }}
36-
- name: Build Server Image
30+
- name: Build and push server image
3731
run: ./gradlew spellsource-server:githubDockerPush
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3834

3935
build-and-deploy-website:
40-
if: "!startsWith(github.ref, 'refs/tags/')" # Deploy a new website version for each push to master
36+
if: "!startsWith(github.ref, 'refs/tags/')"
4137
runs-on: ubuntu-latest
38+
permissions:
39+
contents: read
40+
packages: write
4241
steps:
4342
- uses: actions/checkout@v4
4443
with:
45-
lfs: true # TODO still needed just for website?
44+
lfs: true
45+
submodules: recursive
4646
- run: git lfs checkout
4747
- uses: actions/setup-java@v4
4848
with:
49-
java-version: '23'
49+
java-version: '24'
5050
distribution: temurin
5151
- uses: actions/setup-node@v4
5252
with:
5353
node-version: 22
5454
- uses: gradle/actions/wrapper-validation@v3
5555
- name: Test with Gradle
5656
run: ./gradlew --no-parallel :spellsource-web:yarnRunTest
57-
- name: Log in to the Container registry
58-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
59-
with:
60-
registry: ghcr.io
61-
username: ${{ github.actor }}
62-
password: ${{ secrets.GITHUB_TOKEN }}
63-
- name: Build Website Image
64-
run: ./gradlew spellsource-web:githubDockerPush
57+
- name: Set Project Version
58+
run: |
59+
COMMIT_SHA=$(git rev-parse --short=7 HEAD)
60+
TIMESTAMP=$(date +%s)
61+
echo "PROJECT_VERSION=${COMMIT_SHA}-${TIMESTAMP}" >> $GITHUB_ENV
62+
- name: Build and push website image
63+
run: ./gradlew spellsource-web:githubDockerPush
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}

.github/workflows/gradle-test.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,19 @@ on:
55
jobs:
66
build:
77
runs-on: ubuntu-latest
8-
env:
9-
DOTNET_INSTALL_DIR: ~/.dotnet
108
steps:
119
- uses: actions/checkout@v4
1210
with:
1311
lfs: true
12+
submodules: recursive
1413
- run: git lfs checkout
1514
- uses: actions/setup-java@v4
1615
with:
17-
java-version: '23'
16+
java-version: '24'
1817
distribution: temurin
1918
- uses: actions/setup-node@v4
2019
with:
2120
node-version: 22
22-
- uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: |
25-
6.x.x
2621
- uses: gradle/actions/wrapper-validation@v3
2722
- name: Test with Gradle
2823
run: ./gradlew --no-parallel test

.github/workflows/server.yaml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
name: Build Server
22
on:
33
push:
4-
# branches: ['develop']
5-
tags: [ "*" ]
4+
branches: ['develop']
5+
tags: ['*']
66

77
jobs:
8-
build-and-deploy-server:
8+
test-and-deploy-server:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
1013
steps:
1114
- uses: actions/checkout@v4
1215
with:
1316
lfs: true
17+
submodules: recursive
1418
- run: git lfs checkout
1519
- uses: actions/setup-java@v4
1620
with:
17-
java-version: '23'
21+
java-version: '24'
1822
distribution: temurin
1923
- uses: actions/setup-node@v4
2024
with:
2125
node-version: 22
22-
- uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: |
25-
6.x.x
2626
- uses: gradle/actions/wrapper-validation@v3
27-
- name: Test with Gradle
28-
run: ./gradlew --no-parallel test
29-
- name: Log in to the Container registry
30-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
31-
with:
32-
registry: ghcr.io
33-
username: ${{ github.actor }}
34-
password: ${{ secrets.GITHUB_TOKEN }}
35-
- name: Build Server Image
36-
run: ./gradlew spellsource-server:githubDockerPush
27+
- name: Run server tests
28+
run: ./gradlew --no-parallel spellsource-server:test
29+
- name: Build and push server image
30+
run: ./gradlew spellsource-server:githubDockerPush
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/website.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build Website
22
on:
33
push:
4-
branches: [ 'develop' ]
4+
branches: ['develop']
55
paths:
66
- spellsource-web/**
77
- build.gradle
@@ -11,33 +11,32 @@ on:
1111
jobs:
1212
build-and-deploy-website:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
1417
steps:
1518
- uses: actions/checkout@v4
1619
with:
1720
lfs: true
21+
submodules: recursive
1822
- run: git lfs checkout
1923
- uses: actions/setup-java@v4
2024
with:
21-
java-version: '23'
25+
java-version: '24'
2226
distribution: temurin
2327
- uses: actions/setup-node@v4
2428
with:
2529
node-version: 22
2630
- uses: gradle/actions/wrapper-validation@v3
2731
- name: Test with Gradle
2832
run: ./gradlew --no-parallel :spellsource-web:yarnRunTest
29-
- name: Log in to the Container registry
30-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
31-
with:
32-
registry: ghcr.io
33-
username: ${{ github.actor }}
34-
password: ${{ secrets.GITHUB_TOKEN }}
3533
- name: Set Project Version
3634
run: |
3735
COMMIT_SHA=$(git rev-parse --short=7 HEAD)
3836
TIMESTAMP=$(date +%s)
3937
echo "PROJECT_VERSION=${COMMIT_SHA}-${TIMESTAMP}" >> $GITHUB_ENV
40-
- name: Build Website Image
38+
- name: Build and push website image
4139
run: ./gradlew spellsource-web:githubDockerPush
4240
env:
43-
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}

spellsource-server/build.gradle

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -389,28 +389,26 @@ def spellsourceTags = ['latest', project.version.toString()]
389389
def spellsourceImage = 'ghcr.io/hiddenswitch/spellsource'
390390
jib {
391391
from {
392-
image = "eclipse-temurin:21-ubi9-minimal"
392+
image = "eclipse-temurin:24-ubi9-minimal"
393393
}
394394
to {
395395
image = spellsourceImage
396396
tags = spellsourceTags
397+
if (System.getenv('GITHUB_ACTIONS') != null) {
398+
auth {
399+
username = System.getenv('GITHUB_ACTOR') ?: ''
400+
password = System.getenv('GITHUB_TOKEN') ?: ''
401+
}
402+
}
397403
}
398404
container {
399-
// todo: should this be 8081?
400405
ports = ['8080']
401406
jvmFlags = jvmArgs
402407
}
403408
}
404409

405410
tasks.register('githubDockerPush') {
406-
dependsOn jibDockerBuild
407-
doLast {
408-
for (def image : spellsourceTags.collect { tag -> "$spellsourceImage:$tag" }) {
409-
exec {
410-
commandLine(['docker', 'push'] + [image])
411-
}
412-
}
413-
}
411+
dependsOn jib
414412
}
415413

416414
graphqlCodegen {

spellsource-web/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ tasks.register('githubDockerPush') {
135135
group "spellsource"
136136

137137
doLast {
138+
if (System.getenv('GITHUB_ACTIONS') != null) {
139+
exec {
140+
commandLine 'docker', 'login', 'ghcr.io', '-u', System.getenv('GITHUB_ACTOR') ?: '', '--password-stdin'
141+
standardInput = new ByteArrayInputStream((System.getenv('GITHUB_TOKEN') ?: '').bytes)
142+
}
143+
}
138144
for (def image : spellsourceTags.collect { tag -> "$spellsourceImage:$tag" }) {
139145
exec {
140146
commandLine(['docker', 'push'] + [image])

0 commit comments

Comments
 (0)