Merge pull request #1402 from flanksource/stabalize-ui #577
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: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
semantic-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release-version: ${{ steps.semantic.outputs.new_release_version }} | |
new-release-published: ${{ steps.semantic.outputs.new_release_published }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cycjimmy/semantic-release-action@v3 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
needs: semantic-release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
deployment: [incident-manager-ui, canary-checker-ui] | |
if: ${{ needs.semantic-release.outputs.new-release-published == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Publish to Registry | |
uses: elgohr/Publish-Docker-Github-Action@v4 | |
env: | |
APP_DEPLOYMENT: ${{ matrix.deployment == 'canary-checker-ui' && 'CANARY_CHECKER' || 'INCIDENT_MANAGER' }} | |
WITHOUT_AUTH: ${{ matrix.deployment == 'canary-checker-ui' && 'true' || 'false' }} | |
with: | |
name: flanksource/${{ matrix.deployment }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
buildargs: APP_DEPLOYMENT,WITHOUT_AUTH | |
snapshot: true | |
tags: "latest,v${{ needs.semantic-release.outputs.release-version }}" | |
helm: | |
runs-on: ubuntu-latest | |
needs: semantic-release | |
if: ${{ needs.semantic-release.outputs.new-release-published == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download yq | |
run: | | |
wget -nv -nc -O yq https://github.com/mikefarah/yq/releases/download/v4.20.2/yq_linux_amd64 | |
chmod +x yq | |
- name: Update chart version | |
run: ./yq -i e '.version = "${{ needs.semantic-release.outputs.release-version }}"' chart/Chart.yaml | |
- name: Update app version | |
run: ./yq -i e '.appVersion = "${{ needs.semantic-release.outputs.release-version }}"' chart/Chart.yaml | |
- name: Update image tags | |
run: ./yq -i e '.image.tag = "v${{ needs.semantic-release.outputs.release-version }}"' chart/values.yaml | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.8.0 | |
- name: Package Helm chart | |
run: | | |
helm package ./chart | |
- name: Clone charts repo | |
uses: actions/checkout@v3 | |
with: | |
repository: "${{ github.repository_owner }}/charts" | |
path: charts | |
token: "${{ secrets.FLANKBOT }}" | |
- name: Update chart repo | |
run: | | |
cd charts | |
cp ../flanksource-ui-*.tgz ./ | |
helm repo index --merge index.yaml . | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Release ${{ needs.semantic-release.outputs.release-version }} of ${{ github.repository }}" | |
branch: gh-pages | |
repository: ./charts | |
update-incident-commander: | |
runs-on: ubuntu-latest | |
needs: [docker, helm, semantic-release] | |
if: ${{ needs.semantic-release.outputs.new-release-published == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: "${{ github.repository_owner }}/incident-commander-chart" | |
token: ${{ secrets.FLANKBOT }} | |
path: ./incident-commander-chart | |
- name: Install yq | |
run: | | |
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\ | |
tar xz && sudo mv ${BINARY} /usr/bin/yq | |
env: | |
VERSION: v4.25.1 | |
BINARY: yq_linux_amd64 | |
- name: Update flanksource-ui version in Incident-commander | |
run: | | |
cd incident-commander-chart | |
yq eval-all -i '(.dependencies[] | select(.name == "flanksource-ui")) ref $d | $d.version = "${{ needs.semantic-release.outputs.release-version }}"' chart/Chart.yaml | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "chore: update flanksource-ui chart dependency to ${{ needs.semantic-release.outputs.release-version }}" | |
repository: ./incident-commander-chart |