🎨 style(chart): Reformat yaml files to always include whitespace in t… #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish images | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
jobs: | |
build: | |
name: Publish on container registry | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Get release version | |
if: startsWith(github.ref_name, 'release') | |
uses: actions-ecosystem/action-regex-match@v2 | |
id: release-version | |
with: | |
text: ${{ github.ref_name }} | |
regex: '^release\/v(.*)$' | |
- name: Get fallback release version from chart | |
id: fallback-release-version | |
run: | | |
echo "FALLBACK_RELEASE_VERSION=$(grep 'appVersion' chart/Chart.yaml | cut -d " " -f2)" >> $GITHUB_ENV | |
- name: Set build time | |
run: echo "BUILD_TIME=$(date +%s)" >> $GITHUB_ENV | |
- name: Set image tag if no release | |
run: | | |
echo "IMAGE_TAG=${{ env.FALLBACK_RELEASE_VERSION }}-${{ env.BUILD_TIME }}" >> $GITHUB_ENV | |
- name: Set image release tag | |
if: ${{ steps.release-version.outputs.match != '' }} | |
run: | | |
echo "IMAGE_TAG=${{ steps.release-version.outputs.group1 }}" >> $GITHUB_ENV | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ vars.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache layers | |
uses: actions/cache@v3 | |
with: | |
path: "${{ github.workspace }}/.skaffold/cache" | |
key: skaffold-${{ hashFiles('**/cache') }} | |
restore-keys: | | |
skaffold- | |
- name: Run Skaffold build pipeline | |
uses: hiberbee/[email protected] | |
id: build | |
with: | |
command: build | |
skip-tests: true | |
tag: ${{ env.IMAGE_TAG }} | |
repository: ${{ vars.REGISTRY }}/${{ github.repository }} | |
push: true | |
- name: Update helm image tags | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: 'chart/values.yaml' | |
commitChange: false | |
changes: | | |
{ | |
"userSimulator.cronJob.jobTemplate.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"maliciousLoadGenerator.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"likeService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"paymentService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"profileService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"membershipService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"userAuthService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"adService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"envoyProxy.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"microblogService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"statusService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"proxyService.deployment.container.image.tag": "${{ env.IMAGE_TAG }}", | |
"frontend.deployment.container.image.tag": "${{ env.IMAGE_TAG }}" | |
} | |
- name: Update helm chart appVersion / version | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: 'chart/Chart.yaml' | |
commitChange: false | |
changes: | | |
{ | |
"appVersion": "${{ env.IMAGE_TAG }}", | |
"version": "${{ env.IMAGE_TAG }}" | |
} | |
- name: Publish Helm chart to GHCR | |
run: | | |
helm package chart | |
helm push unguard-${{ env.IMAGE_TAG }}.tgz oci://${{ vars.REGISTRY }}/${{ github.repository }}/chart |