fix(PL-2554): fix chart default values #69
Workflow file for this run
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: Build & Publish | |
on: | |
push: | |
branches: ["master"] | |
paths-ignore: | |
- "chart/Chart.yaml" | |
- "CHANGELOG.md" | |
pull_request: | |
branches: ["master"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
test-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test chart | |
uses: silphid/actions/test-chart@v1 | |
with: | |
work-dir: chart | |
args: --namespace my-namespace --release my-release --app-version 1.0.0 --chart-version 1.0.0 | |
test-app: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Go environment | |
uses: actions/[email protected] | |
with: | |
go-version-file: go.mod | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Setup dependencies | |
run: go mod download | |
- name: Run tests | |
env: | |
GH_USER: nestobot | |
GH_TOKEN: ${{ secrets.TESTING_TOKEN }} | |
CATALOG_URL: https://github.com/nestoca/catalog | |
run: go test ./... | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: actions/checkout@v3 | |
- name: Build Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
publish: | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- test-app | |
- test-chart | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
id-token: write | |
pages: write | |
env: | |
HELM_VERSION: v3.12.2 | |
YQ_VERSION: v4.34.2 | |
steps: | |
- name: Install helm binary | |
run: | | |
curl -L https://get.helm.sh/helm-${{ env.HELM_VERSION }}-linux-amd64.tar.gz | tar xvz | |
sudo mv linux-amd64/helm /usr/local/bin/helm | |
- name: Install yq binary | |
run: | | |
curl -L https://github.com/mikefarah/yq/releases/download/${{ env.YQ_VERSION }}/yq_linux_amd64.tar.gz | tar xvz | |
sudo mv yq_linux_amd64 /usr/local/bin/yq | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Generate changelog and tag release | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v4 | |
with: | |
input-file: CHANGELOG.md | |
output-file: CHANGELOG.md | |
fallback-version: 0.0.0 | |
skip-commit: true | |
skip-version-file: true | |
git-push: false | |
- name: Update versions in chart | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
yq -i '.appVersion = "${{ steps.changelog.outputs.version }}"' 'chart/Chart.yaml' | |
yq -i '.version = "${{ steps.changelog.outputs.version }}"' 'chart/Chart.yaml' | |
- name: Commit release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "chore(release): ${{ steps.changelog.outputs.tag }}" | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern={{version}},value=${{ steps.changelog.outputs.tag }} | |
- name: Build and push Docker image | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Package chart release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
id: chart-release | |
run: | | |
ORG_NAME=${GITHUB_REPOSITORY%%/*} | |
REPO_NAME=${GITHUB_REPOSITORY#*/} | |
CHART_NAME=$(yq .name ${{ github.workspace }}/chart/Chart.yaml) | |
mkdir -p ${{ runner.temp }}/helm-release | |
cd ${{ runner.temp }}/helm-release | |
# Try to get the current index.yaml of the helm repo from https://${ORG_NAME}.github.io/${REPO_NAME}/index.yaml | |
# If it fails, create a new index.yaml | |
curl -f -L https://${ORG_NAME}.github.io/${REPO_NAME}/index.yaml -o index.yaml || echo -e "apiVersion: v1\nentries: {}" > index.yaml | |
helm package ${{ github.workspace }}/chart | |
helm repo index --url https://github.com/${{ github.repository }}/releases/download/${{ steps.changelog.outputs.tag }} --merge index.yaml . | |
echo "artifact-path=${{ runner.temp }}/helm-release/${CHART_NAME}-${{ steps.changelog.outputs.version }}.tgz" >> $GITHUB_OUTPUT | |
- name: Upload pages artifact | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ${{ runner.temp }}/helm-release | |
- name: Push changes | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git push origin master --follow-tags | |
- name: Create Release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
draft: false | |
artifactErrorsFailBuild: true | |
name: ${{ steps.changelog.outputs.tag }} | |
tag: ${{ steps.changelog.outputs.tag }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
token: ${{ github.token }} | |
artifacts: ${{ steps.chart-release.outputs.artifact-path }} | |
- name: Deploy to GitHub Pages | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: actions/deploy-pages@v2 |