Update app in chart #112
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: Update app in chart | |
on: | |
registry_package: | |
types: | |
- published | |
jobs: | |
update-chart: | |
if: ${{ github.event.registry_package.name == 'pipeline-controller' && github.event.registry_package.package_version.container_metadata.tag.name != '' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Import GPG key for signing commits | |
run: | | |
echo -n "$GPG_SIGNING_KEY" | gpg --import | |
key_id=$(echo -n "$GPG_SIGNING_KEY" | gpg --dry-run --import --verbose 2>&1 | awk '/^gpg: sec/ { print $3 }' | cut -d '/' -f 2) | |
git config user.signingkey "${key_id}" | |
git config commit.gpgsign true | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
- name: bump app version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq -i '.appVersion = "${{ github.event.registry_package.package_version.container_metadata.tag.name }}"' charts/pipeline-controller/Chart.yaml | |
- name: get chart version | |
id: get_chart_version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq '.version' charts/pipeline-controller/Chart.yaml | |
- name: increment chart version | |
id: inc_chart_version | |
run: echo NEW_CHART_VERSION=$(echo ${{ steps.get_chart_version.outputs.result }} | awk -F. -v OFS=. '{print $1,++$2,0}') >> $GITHUB_OUTPUT | |
- name: update chart version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq -i '.version = "${{ steps.inc_chart_version.outputs.NEW_CHART_VERSION }}"' charts/pipeline-controller/Chart.yaml | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GHCR_TOKEN }} | |
commit-message: | | |
Update app version in chart | |
committer: wge-build-bot <[email protected]> | |
author: wge-build-bot <[email protected]> | |
branch: update-chart | |
title: Update app version to ${{ github.event.registry_package.package_version.container_metadata.tag.name }} in chart | |
body: | | |
This PR bumps the minor chart version by default. If it is more appropriate to bump the major or the patch versions, please amend the commit accordingly. | |
The workflow that this PR was created from is "${{ github.workflow }}". | |
- name: Check output | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | |
update-wge-chart: | |
if: ${{ github.event.registry_package.name == 'charts/pipeline-controller' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: weaveworks/weave-gitops-enterprise | |
token: ${{ secrets.GHCR_TOKEN }} | |
- name: Setup Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.1 | |
- name: Debug | |
run: echo '${{ toJSON(github.event) }}' | |
- name: Update pipeline-controller chart version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq -i '(.dependencies[] | select(.name=="pipeline-controller") | .version) |= "${{ github.event.registry_package.package_version.container_metadata.tag.name }}"' charts/mccp/Chart.yaml | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Update chart dependencies | |
run: cd ./charts/mccp && helm dependency update | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GHCR_TOKEN }} | |
commit-message: | | |
Update pipeline-controller version in WGE chart | |
committer: wge-build-bot <[email protected]> | |
author: wge-build-bot <[email protected]> | |
branch: update-chart | |
title: Update pipeline-controller version to ${{ github.event.registry_package.package_version.container_metadata.tag.name }} in WGE chart | |
body: | | |
This PR bumps the pipeline-controller chart version. | |
The workflow that this PR was created from is "${{ github.workflow }}". | |
- name: Check output | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | |