Skip to content

Commit

Permalink
added update-helm-charts in staging and prod wf #161
Browse files Browse the repository at this point in the history
  • Loading branch information
akyriako committed Nov 14, 2024
1 parent d93ecaa commit 6922ea9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 5 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/build-publish-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
environment:
name: stable
runs-on: ubuntu-latest

outputs:
image_version: ${{ env.IMAGE_SEMVER }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -79,4 +81,37 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
annotations: ${{ steps.meta.outputs.annotations }}

update-helm-charts:
needs: [build-stable]
environment: stable
runs-on: ubuntu-latest

steps:
- name: Configure Git User as GitHub Actions Bot
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Checkout
uses: actions/checkout@v4
with:
repository: "${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}"
token: ${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}

- name: Update Charts and Commit Changes
id: update_charts
env:
image: ${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }}
tag: ${{ needs.build-stable.outputs.image_version }}
run: |
# docusaurus
sed -i 's/^version: .*/version: ${{ vars.DOCS_NEXT_CHART_VERSION }}.${{github.run_number}}/' ./charts/docusaurus/Chart.yaml
sed -i 's/^appVersion: .*/appVersion: ${{ env.tag }}/' ./charts/docusaurus/Chart.yaml
sed -i 's/^tag: .*/tag: ${{ env.tag }}/' ./charts/docusaurus/values-prod.yaml
sed -i 's/^image: .*/image: ${{ env.image }}/' ./charts/docusaurus/values-prod.yaml
# commit and push
git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}"
git remote set-url origin https://${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}@github.com/${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}.git
git push origin main
37 changes: 35 additions & 2 deletions .github/workflows/build-publish-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
environment:
name: preview
runs-on: ubuntu-latest
outputs:
image_version: ${{ steps.build_image_tag.outputs.image_version }}

steps:
- name: Checkout
Expand All @@ -40,7 +42,7 @@ jobs:

- name: Build Image Tag
id: build_image_tag
run: echo "image_version=${{ steps.date.outputs.today }}.${{github.run_number}}.${{ steps.commit_hash.outputs.short }}" >> $GITHUB_OUTPUT
run: echo "image_version=${{ steps.date.outputs.today }}.${{github.run_number}}.0-${{ steps.commit_hash.outputs.short }}" >> $GITHUB_OUTPUT

- name: Build Container Image Metadata
id: meta
Expand Down Expand Up @@ -88,4 +90,35 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
annotations: ${{ steps.meta.outputs.annotations }}

update-helm-charts:
needs: [build-preview]
environment: preview
runs-on: ubuntu-latest

steps:
- name: Configure Git User as GitHub Actions Bot
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Checkout
uses: actions/checkout@v4
with:
repository: "${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}"
token: ${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}

- name: Update Charts and Commit Changes
id: update_charts
env:
image: ${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }}
tag: ${{ needs.build-preview.outputs.image_version }}
run: |
# docusaurus
sed -i 's/^tag: .*/tag: ${{ env.tag }}/' ./charts/docusaurus/values-stg.yaml
sed -i 's/^image: .*/image: ${{ env.image }}/' ./charts/docusaurus/values-stg.yaml
# commit and push
git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}"
git remote set-url origin https://${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}@github.com/${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}.git
git push origin main
2 changes: 1 addition & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const config: Config = {
],
},
],
copyright: `© T-Systems International GmbH ${new Date().getFullYear()} (v` + process.env.REACT_APP_VERSION + `)`,
copyright: `© T-Systems International GmbH ${new Date().getFullYear()} (` + process.env.REACT_APP_VERSION + `)`,
},
prism: {
theme: prismThemes.oneDark,
Expand Down

0 comments on commit 6922ea9

Please sign in to comment.