Skip to content

Commit

Permalink
Added support for PRs in chartReleaser workflow (#42)
Browse files Browse the repository at this point in the history
* Added support for PRs in chartReleaser workflow
* Added path to image build to avoid rebuilding image when src hasn't changed
* Improved wording of workflow input description
  • Loading branch information
mhaswell-bcgov authored Jul 16, 2024
1 parent 52d3722 commit 9152b83
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/buildTestPublishContainerDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ on:
types:
- published
pull_request:
paths:
- 'src/**'
- 'client/**'
- 'server/**'
- 'test/**'
- 'package-lock.json'
- 'Dockerfile'
workflow_dispatch:
jobs:
install-build-lint-and-test:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/chartReleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,34 @@ on:
release:
types:
- published
pull_request:
paths:
- 'helm/**'
workflow_dispatch:
inputs:
chart_version:
description: 'The chart version to create. Must be a valid semver string and should indicate that it is not a release chart version (eg. 5.1.2-pr36).'
description: 'The chart pre-release version label to create. Will be appended to the current version from helm/Chart.yaml (eg. Entering "pr36" with a helm/Chart.yaml at version 5.1.2 produces the final chart tag "5.1.2-pr36").'
required: true

jobs:
release:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
env:
CHART_VERSION: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.chart_version || null }}"
CHART_VERSION: "${{ (github.event_name == 'workflow_dispatch' && format('-{0}', github.event.inputs.chart_version)) || (github.event_name == 'pull_request' && format('-pr{0}', github.event.pull_request.number)) }}"
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get helm chart version
id: chart
run: "echo \"version=$(helm show chart helm | grep 'version:' | tail -1 | cut -f2 -d' ')\" >> $GITHUB_OUTPUT"
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: ./
branch: gh-pages
target_dir: helm
chart_version: ${{ env.CHART_VERSION }}
chart_version: ${{ format('{0}{1}', steps.chart.outputs.version, env.CHART_VERSION || '') }}
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 5.1.2
version: 5.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down

0 comments on commit 9152b83

Please sign in to comment.