|
9 | 9 | env: |
10 | 10 | tag_prefix: v |
11 | 11 | crds_tag_prefix: crds_v |
| 12 | + hub_manager_tag_prefix: hub-manager_v |
12 | 13 |
|
13 | 14 | jobs: |
14 | 15 | traefik: |
@@ -283,3 +284,130 @@ jobs: |
283 | 284 | signing_passphrase: ${{ secrets.GPG_PASSPHRASE }} |
284 | 285 | if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
285 | 286 |
|
| 287 | + hub-manager: |
| 288 | + runs-on: ubuntu-latest |
| 289 | + steps: |
| 290 | + - name: Checkout |
| 291 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 292 | + with: |
| 293 | + fetch-depth: 0 |
| 294 | + |
| 295 | + - name: Configure Git |
| 296 | + run: | |
| 297 | + git config user.name "$GITHUB_ACTOR" |
| 298 | + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" |
| 299 | + git config --global --add safe.directory /charts |
| 300 | +
|
| 301 | + - name: Copy LICENSE for packaging |
| 302 | + run: | |
| 303 | + cp ./LICENSE ./hub-manager/LICENSE |
| 304 | +
|
| 305 | + - name: Get chart version |
| 306 | + id: chart_version |
| 307 | + run: | |
| 308 | + echo "CHART_VERSION=$(cat hub-manager/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -n 1)" >> $GITHUB_OUTPUT |
| 309 | +
|
| 310 | + - name: Check if tag exists |
| 311 | + id: tag_exists |
| 312 | + run: | |
| 313 | + TAG_EXISTS=false |
| 314 | + if git tag -l | grep '^${{ env.hub_manager_tag_prefix }}${{ steps.chart_version.outputs.CHART_VERSION }}$' > /dev/null ; then |
| 315 | + TAG_EXISTS=true |
| 316 | + fi |
| 317 | + echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT |
| 318 | +
|
| 319 | + - name: Get Previous tag |
| 320 | + id: previous_tag |
| 321 | + uses: "WyriHaximus/github-action-get-previous-tag@61819f33034117e6c686e6a31dba995a85afc9de" # v2.0.0 |
| 322 | + with: |
| 323 | + pattern: "${{ env.hub_manager_tag_prefix }}*" |
| 324 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 325 | + |
| 326 | + - name: Tag release |
| 327 | + id: tag_version |
| 328 | + uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2 |
| 329 | + with: |
| 330 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 331 | + custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }} |
| 332 | + tag_prefix: ${{ env.hub_manager_tag_prefix }} |
| 333 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 334 | + |
| 335 | + - name: Render changelog configuration |
| 336 | + env: |
| 337 | + REGEXP: '(\\(.+\\)|(?!\\(CRDs-.+\\)))' |
| 338 | + run: | |
| 339 | + export DATE=$(date +%F); cat .github/workflows/changelog.json | envsubst > /tmp/changelog.json; cat /tmp/changelog.json |
| 340 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 341 | + |
| 342 | + - name: Build Changelog |
| 343 | + id: changelog |
| 344 | + uses: mikepenz/release-changelog-builder-action@bcae7115752d4ed746ff92feb666574428a79415 # v6.2.1 |
| 345 | + with: |
| 346 | + fromTag: ${{ steps.previous_tag.outputs.tag }} |
| 347 | + toTag: ${{ steps.tag_version.outputs.new_tag }} |
| 348 | + configuration: "/tmp/changelog.json" |
| 349 | + env: |
| 350 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 351 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 352 | + |
| 353 | + - name: Create release |
| 354 | + uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 |
| 355 | + with: |
| 356 | + tag: ${{ steps.tag_version.outputs.new_tag }} |
| 357 | + name: ${{ steps.tag_version.outputs.new_tag }} |
| 358 | + body: ${{ steps.changelog.outputs.changelog }} |
| 359 | + prerelease: ${{ contains(steps.chart_version.outputs.CHART_VERSION, '-') }} |
| 360 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 361 | + |
| 362 | + - name: Delete other charts |
| 363 | + run: | |
| 364 | + rm -rf traefik |
| 365 | + rm -rf traefik-crds |
| 366 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 367 | + |
| 368 | + - name: Import GPG key |
| 369 | + uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 |
| 370 | + id: gpg |
| 371 | + with: |
| 372 | + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 373 | + passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 374 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 375 | + |
| 376 | + - name: Prepare GPG key |
| 377 | + run: | |
| 378 | + gpg --export > ~/.gnupg/pubring.gpg |
| 379 | + gpg --batch --pinentry-mode loopback --yes --passphrase '${{ secrets.GPG_PASSPHRASE }}' --export-secret-key > ~/.gnupg/secring.gpg |
| 380 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 381 | + |
| 382 | + - name: Publish Helm chart |
| 383 | + uses: bpsoraggi/helm-gh-pages@2a2569e394590687d2c508516af3c9bb9fe7fa7e |
| 384 | + with: |
| 385 | + token: ${{ secrets.CHARTS_TOKEN }} |
| 386 | + charts_dir: . |
| 387 | + charts_url: https://traefik.github.io/charts |
| 388 | + owner: traefik |
| 389 | + repository: charts |
| 390 | + branch: master |
| 391 | + target_dir: hub-manager |
| 392 | + index_dir: . |
| 393 | + commit_username: traefiker |
| 394 | + commit_email: 30906710+traefiker@users.noreply.github.com |
| 395 | + key: ${{ steps.gpg.outputs.name }} |
| 396 | + private_key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 397 | + passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 398 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
| 399 | + |
| 400 | + - name: Publish Helm chart to the ghcr.io registry |
| 401 | + uses: appany/helm-oci-chart-releaser@d94988c92bed2e09c6113981f15f8bb495d10943 # v0.5.0 |
| 402 | + with: |
| 403 | + name: hub-manager |
| 404 | + repository: traefik/helm |
| 405 | + tag: ${{ steps.chart_version.outputs.CHART_VERSION }} |
| 406 | + path: ./hub-manager |
| 407 | + registry: ghcr.io |
| 408 | + registry_username: traefiker |
| 409 | + registry_password: ${{ secrets.GHCR_TOKEN }} |
| 410 | + sign: true |
| 411 | + signing_key: ${{ steps.gpg.outputs.name }} |
| 412 | + signing_passphrase: ${{ secrets.GPG_PASSPHRASE }} |
| 413 | + if: steps.tag_exists.outputs.TAG_EXISTS == 'false' |
0 commit comments