|
1 | 1 | ---
|
2 |
| - name: Helm Push to GHCR |
3 |
| - |
4 |
| - on: |
5 |
| - push: |
6 |
| - tags: |
7 |
| - - 'chart-[0-9]+.[0-9]+.[0-9]+' |
8 |
| - - 'chart-[0-9]+.[0-9]+.[0-9]+-*' |
9 |
| - workflow_dispatch: |
10 |
| - inputs: |
11 |
| - ref: |
12 |
| - description: 'Branch, commit, or tag to checkout' |
13 |
| - required: true |
14 |
| - env: |
15 |
| - GCR: ghcr.io/${{ github.repository_owner }} |
16 |
| - |
17 |
| - jobs: |
18 |
| - publish-chart: |
19 |
| - runs-on: ubuntu-latest |
20 |
| - permissions: |
21 |
| - contents: read |
22 |
| - packages: write |
23 |
| - steps: |
24 |
| - - name: Checkout code |
25 |
| - uses: actions/checkout@v4 |
26 |
| - with: |
27 |
| - ref: ${{ github.event.inputs.ref || github.ref }} |
28 |
| - - name: Install Helm |
29 |
| - uses: azure/setup-helm@v3 |
30 |
| - with: |
31 |
| - version: 3.13.2 |
32 |
| - token: ${{ secrets.GITHUB_TOKEN }} |
33 |
| - - name: Install yq |
34 |
| - run: sudo snap install yq |
35 |
| - - name: Extract Chart Version |
36 |
| - id: extract_version |
37 |
| - run: | |
38 |
| - VERSION=$(yq e '.version' charts/argo-diff/Chart.yaml) |
39 |
| - echo "chart_version=$VERSION" >> $GITHUB_OUTPUT |
40 |
| - - name: Verify Chart Version |
41 |
| - if: ${{ startsWith(github.ref, 'refs/tags/') }} |
42 |
| - run: | |
43 |
| - TAG_VERSION=${GITHUB_REF#refs/tags/} |
44 |
| - if [ "$TAG_VERSION" != "chart-${{ steps.extract_version.outputs.chart_version }}" ]; then |
45 |
| - echo "Tag version ($TAG_VERSION) does not match the chart version (${{ steps.extract_version.outputs.chart_version }})" |
46 |
| - exit 1 |
47 |
| - fi |
48 |
| - - name: Helm login |
49 |
| - run: | |
50 |
| - helm version |
51 |
| - cd charts/argo-diff |
52 |
| - echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.GCR }} --username ${{ github.repository_owner }} --password-stdin |
53 |
| - - name: Helm push |
54 |
| - run: | |
55 |
| - set -x |
56 |
| - cd charts/argo-diff |
57 |
| - version=${{ steps.extract_version.outputs.chart_version }} |
58 |
| - helm package . |
59 |
| - helm push ./argo-diff-$version.tgz oci://${{ env.GCR }}/chart |
60 |
| - - name: Helm logout |
61 |
| - run: helm registry logout ${{ env.GCR }} |
| 2 | +name: Helm Push to GHCR |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'chart-[0-9]+.[0-9]+.[0-9]+' |
| 8 | + - 'chart-[0-9]+.[0-9]+.[0-9]+-*' |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + ref: |
| 12 | + description: 'Branch, commit, or tag to checkout' |
| 13 | + required: true |
| 14 | +env: |
| 15 | + GCR: ghcr.io/${{ github.repository_owner }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + publish-chart: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + packages: write |
| 23 | + steps: |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 28 | + #- name: Install Helm |
| 29 | + # uses: azure/setup-helm@v3 |
| 30 | + # with: |
| 31 | + # version: 3.13.2 |
| 32 | + # token: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + - name: Install yq |
| 34 | + run: sudo snap install yq |
| 35 | + - name: Extract Chart Version |
| 36 | + id: extract_version |
| 37 | + run: | |
| 38 | + VERSION=$(yq e '.version' charts/argo-diff/Chart.yaml) |
| 39 | + echo "chart_version=$VERSION" >> $GITHUB_OUTPUT |
| 40 | + - name: Verify Chart Version |
| 41 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 42 | + run: | |
| 43 | + TAG_VERSION=${GITHUB_REF#refs/tags/} |
| 44 | + if [ "$TAG_VERSION" != "chart-${{ steps.extract_version.outputs.chart_version }}" ]; then |
| 45 | + echo "Tag version ($TAG_VERSION) does not match the chart version (${{ steps.extract_version.outputs.chart_version }})" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | + - name: Helm login |
| 49 | + run: | |
| 50 | + helm version |
| 51 | + cd charts/argo-diff |
| 52 | + echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.GCR }} --username ${{ github.repository_owner }} --password-stdin |
| 53 | + - name: Helm push |
| 54 | + run: | |
| 55 | + set -x |
| 56 | + cd charts/argo-diff |
| 57 | + version=${{ steps.extract_version.outputs.chart_version }} |
| 58 | + helm package . |
| 59 | + helm push ./argo-diff-$version.tgz oci://${{ env.GCR }}/chart |
| 60 | + - name: Helm logout |
| 61 | + run: helm registry logout ${{ env.GCR }} |
0 commit comments