11name : Build Image
22on :
33 push :
4- branches : [ 'master' ]
5- tags : [ '*' ]
4+ branches : ['develop' ]
5+ tags : ['*']
66
77jobs :
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 }}
0 commit comments