Skip to content

Commit

Permalink
Merge pull request #4 from sgibson91/commit-across-branches
Browse files Browse the repository at this point in the history
Check out 2 branches into subfolders to avoid issues with add-and-commit action
  • Loading branch information
sgibson91 authored Sep 12, 2024
2 parents 579b195 + 6ddb51b commit 1808b4b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ jobs:
publish-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
- name: Checkout main branch
uses: actions/checkout@v4
with:
fetch-depth: 0
path: main

- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages

- name: Login to quay.io
if: github.event_name != 'pull_request'
Expand All @@ -36,24 +43,32 @@ jobs:

- name: Run chartpress
if: github.event_name != 'pull_request'
working-directory: main
run: chartpress --push

- name: Run chartpress (no push)
if: github.event_name == 'pull_request'
working-directory: main
run: chartpress

- name: Get chart version
id: get-version
working-directory: main
run: echo "VERSION=$(cat gcpFilestoreBackups/Chart.yaml | grep version | awk '{print $2}' )" >> $GITHUB_OUTPUT

- name: Package helm chart
working-directory: main
run: |
helm package gcpFilestoreBackups
- name: Move the helm chart binary to the other checked out branch folder
run: |
helm package gcpFilestoreBackups -d .helm-charts
mv main/gcpFilestoreBackups-${{ steps.get-version.outputs.VERSION }}.tgz gh-pages/
- name: Commit helm chart to gh-pages branch
if: github.event_name != 'pull_request'
working-directory: gh-pages
uses: EndBug/add-and-commit@v9
with:
add: .helm-charts/gcpFilestoreBackups-${{ steps.get-version.outputs.VERSION }}.tgz
add: gcpFilestoreBackups-${{ steps.get-version.outputs.VERSION }}.tgz
message: "Publish version ${{ steps.get-version.outputs.VERSION }} of gcpFilestoreBackups helm chart"
new_branch: gh-pages

0 comments on commit 1808b4b

Please sign in to comment.