|
| 1 | +name: Release - Tag from master + Docker Hub Push |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag_version: |
| 7 | + description: "Release tag/version to create (e.g., 16.1.0)" |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + next_dev_version: |
| 11 | + description: "Next development version after tagging (e.g., 16.1.1-SNAPSHOT)" |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + push_to_dockerhub: |
| 15 | + description: "Push Docker image to Docker Hub? Push only during major and minor releases (e.g., 16.0.0 or 16.1.0), not for patch releases (e.g., 16.1.1)" |
| 16 | + required: true |
| 17 | + type: choice |
| 18 | + options: |
| 19 | + - "no" |
| 20 | + - "yes" |
| 21 | + default: "no" |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write |
| 25 | + |
| 26 | +env: |
| 27 | + JIRA_NAME: knowhow-processors-jira |
| 28 | + JIRA_XRAY_ZEPHYR_SQUAD_NAME: knowhow-processors-jira-xray-zephyr-squad |
| 29 | + JIRA_ZEPHYR_SCALE_NAME: knowhow-processors-jira-zephyr-scale |
| 30 | + DEVOPS_NAME: knowhow-processors-devops-processor |
| 31 | + AZUREBOARD_NAME: knowhow-processors-azure-boards |
| 32 | + AZUREPIPELINE_NAME: knowhow-processors-azure-pipeline-repo-processor |
| 33 | + RALLY_NAME: knowhow-processors-rally |
| 34 | + SCM_NAME: knowhow-processors-knowhow-scm-processor |
| 35 | + DATA_PROCESSOR_NAME: knowhow-processors-data-processor |
| 36 | + DOCKERHUB_ORG: psknowhow |
| 37 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # without .azurecr.io |
| 38 | + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |
| 39 | + |
| 40 | +jobs: |
| 41 | + tag_build_optional_push: |
| 42 | + name: Tag, Build, Optional Docker Hub Push |
| 43 | + runs-on: ubuntu-latest |
| 44 | + timeout-minutes: 40 |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout master |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + ref: master |
| 51 | + fetch-depth: 0 |
| 52 | + |
| 53 | + - name: Set up Git identity (for commits/tags) |
| 54 | + run: | |
| 55 | + git config user.name "github-actions[bot]" |
| 56 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 57 | +
|
| 58 | + - name: Set Up Java 17 |
| 59 | + uses: actions/setup-java@v4 |
| 60 | + with: |
| 61 | + distribution: "temurin" |
| 62 | + java-version: "17" |
| 63 | + cache: "maven" |
| 64 | + |
| 65 | + # Optional: Configure Maven to use GitHub Packages (keep if you need private deps) |
| 66 | + - name: Configure Maven settings.xml for GitHub Packages |
| 67 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 68 | + run: | |
| 69 | + mkdir -p ~/.m2 |
| 70 | + cat > ~/.m2/settings.xml <<'EOF' |
| 71 | + <settings> |
| 72 | + <servers> |
| 73 | + <server> |
| 74 | + <id>github</id> |
| 75 | + <username>${{ github.actor }}</username> |
| 76 | + <password>${{ secrets.MAVEN_TOKEN }}</password> |
| 77 | + </server> |
| 78 | + </servers> |
| 79 | + <profiles> |
| 80 | + <profile> |
| 81 | + <id>github</id> |
| 82 | + <repositories> |
| 83 | + <repository> |
| 84 | + <id>github</id> |
| 85 | + <url>https://maven.pkg.github.com/PublicisSapient/knowhow-ai-gateway-client</url> |
| 86 | + </repository> |
| 87 | + </repositories> |
| 88 | + </profile> |
| 89 | + </profiles> |
| 90 | + <activeProfiles> |
| 91 | + <activeProfile>github</activeProfile> |
| 92 | + </activeProfiles> |
| 93 | + </settings> |
| 94 | + EOF |
| 95 | +
|
| 96 | + # Optional: Clone & build knowhow-common if your build requires it |
| 97 | + - name: Clone & Build knowhow-common |
| 98 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 99 | + run: | |
| 100 | + echo "Cloning knowhow-common branch outside the main repo workspace" |
| 101 | + git clone --branch "${{ inputs.tag_version }}" https://github.com/PublicisSapient/knowhow-common.git /tmp/knowhow-common |
| 102 | + cd /tmp/knowhow-common && mvn clean install -DskipTests |
| 103 | +
|
| 104 | + - name: Set project version to release |
| 105 | + run: | |
| 106 | + mvn -B -ntp versions:set \ |
| 107 | + -DnewVersion="${{ inputs.tag_version }}" \ |
| 108 | + -DprocessAllModules=true \ |
| 109 | + -DgenerateBackupPoms=false |
| 110 | + |
| 111 | + - name: Update common dependency to release version |
| 112 | + run: | |
| 113 | + mvn -B -ntp versions:use-dep-version \ |
| 114 | + -Dincludes=com.publicissapient.kpidashboard:common \ |
| 115 | + -DdepVersion="${{ inputs.tag_version }}" \ |
| 116 | + -DforceVersion=true \ |
| 117 | + -DprocessAllModules=true \ |
| 118 | + -DgenerateBackupPoms=false |
| 119 | +
|
| 120 | + - name: Commit release version change |
| 121 | + run: | |
| 122 | + git add -A |
| 123 | + git commit -m "chore(release): ${{ inputs.tag_version }}" || echo "No changes to commit" |
| 124 | +
|
| 125 | + - name: Create annotated git tag |
| 126 | + run: | |
| 127 | + git tag -a "${{ inputs.tag_version }}" -m "Release ${{ inputs.tag_version }}" |
| 128 | +
|
| 129 | + - name: Push commit + tag to origin/master |
| 130 | + run: | |
| 131 | + # avoid staging a submodule path accidentally if knowhow-common exists in the superproject |
| 132 | + git restore --staged knowhow-common || true |
| 133 | + git restore knowhow-common || true |
| 134 | + git push origin master |
| 135 | + git push origin --follow-tags |
| 136 | +
|
| 137 | + - name: Build jar skip tests |
| 138 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 139 | + run: | |
| 140 | + mvn clean install -Ddockerfile.skip=true -DskipTests |
| 141 | +
|
| 142 | + - name: Set up Docker Buildx |
| 143 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 144 | + uses: docker/setup-buildx-action@v3 |
| 145 | + |
| 146 | + - name: Docker login (Docker Hub) |
| 147 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 148 | + uses: docker/login-action@v3 |
| 149 | + with: |
| 150 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 151 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 152 | + |
| 153 | + - name: Build and push JIRA Docker image to Docker Hub |
| 154 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 155 | + uses: docker/build-push-action@v6 |
| 156 | + with: |
| 157 | + context: jira/ |
| 158 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 159 | + tags: | |
| 160 | + ${{ env.DOCKERHUB_ORG }}/${{ env.JIRA_NAME }}:${{ inputs.tag_version }} |
| 161 | + |
| 162 | + - name: Build and push DevOps Docker image to Docker Hub |
| 163 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 164 | + uses: docker/build-push-action@v6 |
| 165 | + with: |
| 166 | + context: . |
| 167 | + file: devops-processor-startup/Dockerfile |
| 168 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 169 | + tags: | |
| 170 | + ${{ env.DOCKERHUB_ORG }}/${{ env.DEVOPS_NAME }}:${{ inputs.tag_version }} |
| 171 | + |
| 172 | + - name: Build and push Rally Docker image to Docker Hub |
| 173 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 174 | + uses: docker/build-push-action@v6 |
| 175 | + with: |
| 176 | + context: rally/ |
| 177 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 178 | + tags: | |
| 179 | + ${{ env.DOCKERHUB_ORG }}/${{ env.RALLY_NAME }}:${{ inputs.tag_version }} |
| 180 | +
|
| 181 | + - name: Build and push JIRA Zephyr scale Docker image to Docker Hub |
| 182 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 183 | + uses: docker/build-push-action@v6 |
| 184 | + with: |
| 185 | + context: jira-zephyr-scale/ |
| 186 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 187 | + tags: | |
| 188 | + ${{ env.DOCKERHUB_ORG }}/${{ env.JIRA_ZEPHYR_SCALE_NAME }}:${{ inputs.tag_version }} |
| 189 | +
|
| 190 | + - name: Build and push JIRA Zephyr Squad Docker image to Docker Hub |
| 191 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 192 | + uses: docker/build-push-action@v6 |
| 193 | + with: |
| 194 | + context: jira-xray-zephyr-squad/ |
| 195 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 196 | + tags: | |
| 197 | + ${{ env.DOCKERHUB_ORG }}/${{ env.JIRA_XRAY_ZEPHYR_SQUAD_NAME }}:${{ inputs.tag_version }} |
| 198 | +
|
| 199 | + - name: Build and push Azure Board Docker image to Docker Hub |
| 200 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 201 | + uses: docker/build-push-action@v6 |
| 202 | + with: |
| 203 | + context: azure-boards/ |
| 204 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 205 | + tags: | |
| 206 | + ${{ env.DOCKERHUB_ORG }}/${{ env.AZUREBOARD_NAME }}:${{ inputs.tag_version }} |
| 207 | +
|
| 208 | + - name: Build and push Azure Pipeline Repo Docker image to Docker Hub |
| 209 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 210 | + uses: docker/build-push-action@v6 |
| 211 | + with: |
| 212 | + context: . |
| 213 | + file: azure-pipeline-repo-processor-startup/Dockerfile |
| 214 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 215 | + tags: | |
| 216 | + ${{ env.DOCKERHUB_ORG }}/${{ env.AZUREPIPELINE_NAME }}:${{ inputs.tag_version }} |
| 217 | +
|
| 218 | + - name: Build and push SCM Processor Docker image to Docker Hub |
| 219 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 220 | + uses: docker/build-push-action@v6 |
| 221 | + with: |
| 222 | + context: knowhow-scm-processor/ |
| 223 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 224 | + tags: | |
| 225 | + ${{ env.DOCKERHUB_ORG }}/${{ env.SCM_NAME }}:${{ inputs.tag_version }} |
| 226 | +
|
| 227 | + - name: Build and push Data Processor Docker image to Docker Hub |
| 228 | + if: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 229 | + uses: docker/build-push-action@v6 |
| 230 | + with: |
| 231 | + context: data-processor/ |
| 232 | + push: ${{ inputs.push_to_dockerhub == 'yes' }} |
| 233 | + tags: | |
| 234 | + ${{ env.DOCKERHUB_ORG }}/${{ env.DATA_PROCESSOR_NAME }}:${{ inputs.tag_version }} |
| 235 | +
|
| 236 | + - name: Bump to next development version |
| 237 | + run: | |
| 238 | + mvn -B -ntp versions:set \ |
| 239 | + -DnewVersion="${{ inputs.next_dev_version }}" \ |
| 240 | + -DprocessAllModules=true \ |
| 241 | + -DgenerateBackupPoms=false |
| 242 | +
|
| 243 | + - name: Commit next development version bump |
| 244 | + run: | |
| 245 | + git add -A |
| 246 | + git commit -m "chore: bump version to ${{ inputs.next_dev_version }}" || echo "No changes to commit" |
| 247 | +
|
| 248 | + - name: Push next development version commit to origin/master |
| 249 | + run: | |
| 250 | + git push origin master |
0 commit comments