@@ -33,19 +33,39 @@ jobs:
3333 java_version : [21]
3434 permissions :
3535 contents : write
36+ id-token : write
3637
3738 steps :
3839 - name : Environment
3940 run : env | sort
4041
4142 - name : Checkout
42- uses : actions/checkout@v4
43+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6.0.2
4344 with :
4445 fetch-depth : 1
4546 submodules : true
4647
48+ - name : Detect release commit
49+ id : detect-release
50+ env :
51+ COMMIT_MSG : ${{ github.event.head_commit.message }}
52+ run : |
53+ # Only direct pushes whose first line tags `[release]` should publish.
54+ # Squash merges append "(#NNN)" and merge commits start with "Merge pull request #NNN" —
55+ # both must be excluded so a PR body mentioning [release] does not trigger a release.
56+ first_line=$(printf '%s\n' "$COMMIT_MSG" | head -n1)
57+ if [[ "$first_line" == *"[release]"* ]] \
58+ && [[ ! "$first_line" =~ \(#[0-9]+\)$ ]] \
59+ && [[ ! "$first_line" =~ ^Merge\ pull\ request\ #[0-9]+ ]]; then
60+ echo "Detected release commit — release steps will run"
61+ echo "is_release=true" >> "$GITHUB_OUTPUT"
62+ else
63+ echo "Not a release commit — release steps will be skipped"
64+ echo "is_release=false" >> "$GITHUB_OUTPUT"
65+ fi
66+
4767 - name : Setup Java ${{ matrix.java_version }}
48- uses : actions/setup-java@v4
68+ uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # ratchet:actions/setup-java@v5.2.0
4969 with :
5070 java-version : ${{matrix.java_version}}
5171 distribution : ' temurin'
@@ -79,12 +99,66 @@ jobs:
7999 run : |
80100 sudo rm -rf /home/runner/work/wave/wave/build-workspace
81101
102+ - name : Login to legacy ECR
103+ if : " steps.detect-release.outputs.is_release == 'true'"
104+ uses : docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # ratchet:docker/login-action@v4.2.0
105+ with :
106+ registry : 195996028523.dkr.ecr.eu-west-1.amazonaws.com
107+ username : ${{ secrets.TOWER_CI_AWS_ACCESS }}
108+ password : ${{ secrets.TOWER_CI_AWS_SECRET }}
109+ env :
110+ AWS_REGION : eu-west-1
111+
112+ - name : Configure AWS credentials for platform pusher
113+ if : " steps.detect-release.outputs.is_release == 'true'"
114+ uses : aws-actions/configure-aws-credentials@acca2b1b2070338fb9fd1ca27ecee81d687e58e5 # ratchet:aws-actions/configure-aws-credentials@v6.1.2
115+ with :
116+ aws-region : eu-west-2
117+ role-to-assume : arn:aws:iam::232933512461:role/wave-ecr-pusher
118+ role-session-name : GitHubActions-${{ github.run_id }}
119+
120+ - name : Login to enterprise Amazon ECR
121+ if : " steps.detect-release.outputs.is_release == 'true'"
122+ uses : aws-actions/amazon-ecr-login@fa648b43de3d4d023bcb3f89ed6940096949c419 # ratchet:aws-actions/amazon-ecr-login@v2.1.5
123+
82124 - name : Release
83- if : " contains(github.event.head_commit.message, '[release]')"
125+ id : release
126+ if : " steps.detect-release.outputs.is_release == 'true'"
84127 run : |
128+ set -e
129+ set -x
130+ # Drop the session token injected by configure-aws-credentials so publish.sh / gradle
131+ # sign maven S3 uploads with the static TOWER_CI keys only (mixing static keys with a
132+ # session token from a different role produces SignatureDoesNotMatch).
133+ unset AWS_SESSION_TOKEN
85134 bash publish.sh wave-api
86135 bash publish.sh wave-utils
87- bash tag-and-push.sh
136+
137+ TAG=v$(cat VERSION)
138+
139+ # Tag repo
140+ REMOTE=https://oauth:$GITHUB_TOKEN@github.com/${GITHUB_REPOSITORY}.git
141+ git tag $TAG
142+ git push $REMOTE $TAG
143+
144+ # Build container image locally with a generic name
145+ ./gradlew -PjibRepo=wave/server:$TAG jibDockerBuild
146+
147+ # Push nf-tower-enterprise/wave to legacy ECR
148+ LEGACY_ECR=195996028523.dkr.ecr.eu-west-1.amazonaws.com
149+ docker tag wave/server:$TAG $LEGACY_ECR/nf-tower-enterprise/wave:$TAG
150+ docker push $LEGACY_ECR/nf-tower-enterprise/wave:$TAG
151+
152+ # Push to enterprise ECR (new central registry)
153+ ENTERPRISE_ECR=232933512461.dkr.ecr.eu-west-2.amazonaws.com
154+ docker tag wave/server:$TAG $ENTERPRISE_ECR/wave/server:$TAG
155+ docker push $ENTERPRISE_ECR/wave/server:$TAG
156+
157+ # Create GitHub release (draft for alpha/beta/RC tags)
158+ grep -Ei '.*-(A[0-9]+|B[0-9]+|RC[0-9]+)$' VERSION &>/dev/null && DRAFT='--draft' || DRAFT=''
159+ gh release create $TAG --generate-notes $DRAFT
160+
161+ echo "version=$TAG" >> $GITHUB_OUTPUT
88162 env :
89163 GRADLE_OPTS : ' -Dorg.gradle.daemon=false'
90164 AWS_ACCESS_KEY_ID : ${{secrets.TOWER_CI_AWS_ACCESS}}
@@ -99,16 +173,16 @@ jobs:
99173
100174 - name : Publish tests report
101175 if : failure()
102- uses : actions/upload-artifact@v4
176+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # ratchet:actions/upload-artifact@v7.0.1
103177 with :
104178 name : test-reports-jdk-${{ matrix.java_version }}
105179 path : |
106180 **/build/reports/tests/test
107181
108- - name : Publish code coverage report
182+ - name : Publish code coverage report
109183 if : success()
110- uses : actions/upload-artifact@v4
111- with :
112- name : code-coverage-reports-jdk-${{ matrix.java_version }}
113- path : |
184+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # ratchet:actions/upload-artifact@v7.0.1
185+ with :
186+ name : code-coverage-reports-jdk-${{ matrix.java_version }}
187+ path : |
114188 **/build/reports/jacoco/test
0 commit comments