Merge pull request #4 from paologallinaharbur/pr #2
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: Release newrelic infrastructure chart | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
# We trigger the release merely if the Chart.yaml has been modified | |
- 'deployment/charts/**/Chart.yaml' | |
jobs: | |
# Sometimes chart-releaser might fetch an outdated index.yaml from gh-pages, causing a WAW hazard on the repo | |
# This job checks the remote file is up to date with the local one on release | |
validate-gh-pages-index: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
- name: Download remote index file and check equality | |
run: | | |
curl -vsSL https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/index.yaml > index.yaml.remote | |
LOCAL="$(md5sum < index.yaml)" | |
REMOTE="$(md5sum < index.yaml.remote)" | |
echo "$LOCAL" = "$REMOTE" | |
test "$LOCAL" = "$REMOTE" | |
chart-release: | |
runs-on: ubuntu-latest | |
needs: [ validate-gh-pages-index ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Add newrelic repository | |
run: | | |
helm repo add newrelic https://helm-charts.newrelic.com | |
helm repo add flux2 https://fluxcd-community.github.io/helm-charts | |
- name: Release workload charts | |
uses: helm/[email protected] | |
with: | |
charts_dir: "deployment/charts" | |
mark_as_latest: false | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
CR_RELEASE_NAME_TEMPLATE: "chart-{{ .Name }}-{{ .Version }}" |