Skip to content

enhancement: use ghcr instead of self hosted registry #46

enhancement: use ghcr instead of self hosted registry

enhancement: use ghcr instead of self hosted registry #46

name: Test Release Chart
on:
push:
branches:
- main
paths:
- '_tests/charts/**'
- 'action.yml'
- '.github/workflows/release_chart.yaml'
issue_comment:
types:
- created
env:
chart_registry_url: localhost:5000
chart_registry_repo_name: ${{ github.repository_owner }}/helm-charts
chart_auth_username: test
chart_auth_password: Test123!
GO_VERSION: 1.20
permissions:
contents: write
packages: write
issues: write
pull-requests: write
jobs:
helm_release:
runs-on: ubuntu-latest
# either execute on push to main or on comment to PR with '/test'
if: (github.event_name == 'push' && github.ref_name == 'main') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test'))
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test')
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.issue.pull_request.head.ref }}
- name: Checkout
if: ${{ !github.event.issue.pull_request }}
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Start local registry
working-directory: _tests
run: |
docker-compose up -d
- name: Release Chart
uses: urbanmedia/helm-chart-releaser-action@main
id: release_chart
env:
DEBUG: true
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}
github_actor: ${{ github.actor }}
charts_dir: _tests/charts
chart_repository_url: oci://${{ env.chart_registry_url }}/${{ env.chart_registry_repo_name }}
chart_repository_username: ${{ env.chart_auth_username }}
chart_repository_password: ${{ env.chart_auth_password }}
- name: Remove git tag from remote
if: always()
continue-on-error: true
run: |
git push --delete origin test-chart-0.1.0
- name: Stop local registry
working-directory: _tests
run: |
docker-compose down --rmi local
- name: Comment PR
if: failure() && github.event.issue.pull_request && contains(github.event.comment.body, '/test')
uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ github.event.issue.number }}
comment_tag: test-chart
message: |
# :x: Failed to Test Release Chart
***Job Status:*** ${{ job.status }}
***Release Chart step Conclusion:*** `${{ steps.release_chart.conclusion }}`
***Release Chart step Outcome:*** `${{ steps.release_chart.outcome }}`