11name : Continuous Integration
22
3- # Controls when the action will run. Triggers the workflow on push or pull request.
43on : [ push ]
54
65env :
76 DOCKER_USERNAME : " ${{ github.actor }}"
87 DOCKER_PASSWORD : " ${{ secrets.GITHUB_TOKEN }}"
98
10- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
119jobs :
12- # This workflow contains a single job called "build"
1310 build :
14- # The type of runner that the job will run on
1511 runs-on : ubuntu-latest
1612
17- # Steps represent a sequence of tasks that will be executed as part of the job
1813 steps :
19- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20- - uses : actions/checkout@v2
14+ - uses : actions/checkout@v4
2115 with :
2216 submodules : recursive
2317
2418 - name : Setup Java JDK
25- uses : actions/setup-java@v1.4.3
19+ uses : actions/setup-java@v4
2620 with :
21+ distribution : " temurin"
2722 java-version : 17
28-
29- - name : Grant execute permission for gradlew
30- run : chmod +x gradlew
23+ cache : " gradle"
3124
3225 # Because waiting for the Docker image to be built is kinda boring not gonna lie
3326 - name : Cache Docker image
3427 id : cache-docker-image
35- uses : actions/cache@v2
28+ uses : actions/cache@v4
3629 with :
3730 path : docker
3831 key : docker-image-${{ runner.os }}-${{ hashFiles('docker/Dockerfile') }}
@@ -43,22 +36,22 @@ jobs:
4336 cd docker
4437 bash build.sh
4538
46- - name : Build with Gradle
47- uses : gradle/gradle-build-action@v2
48- with :
49- arguments : build
39+ - name : Grant execute permission for gradlew
40+ run : chmod +x gradlew
5041
51- - name : Publish to PerfectDreams' repository
42+ - name : Build and Publish with Gradle
5243 if : github.ref == 'refs/heads/master'
53- uses : gradle/gradle-build-action@v2
5444 env :
5545 ORG_GRADLE_PROJECT_PerfectDreamsUsername : ${{ secrets.PERFECTDREAMS_REPO_USERNAME }}
5646 ORG_GRADLE_PROJECT_PerfectDreamsPassword : ${{ secrets.PERFECTDREAMS_REPO_PASSWORD }}
57- with :
58- arguments : " :common:publish :client:publish"
47+ run : ./gradlew build :common:publish :client:publish :image-generation-server:jibDockerBuild --no-daemon
48+
49+ - name : Build with Gradle
50+ if : github.ref != 'refs/heads/master'
51+ run : ./gradlew build --no-daemon
5952
60- - name : Publish to Docker
53+ - name : Login and publish Docker images
6154 if : github.ref == 'refs/heads/master'
62- uses : gradle/gradle-build-action@v2
63- with :
64- arguments : " : image-generation- server:jib "
55+ run : |
56+ docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD ghcr.io
57+ docker push ghcr.io/lorittabot/gabriela- image-server:latest
0 commit comments