Bump Github actions plugins #230
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: Nussknacker helm CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
env: | |
CHART_SRC_DIR: ./src | |
XDG_CACHE_HOME: $GITHUB_WORKSPACE/.cache/ | |
RELEASE_NAME: hermes-helm-release-${{github.run_id}} | |
NAME: hermes | |
CHART_REPOSITORY_AUTH: "${{ secrets.CHARTS_PUBLIC_AUTH}}" | |
CHARTS_PUBLIC_SNAPSHOTS_URL: "https://helm-charts.touk.pl/nexus/repository/helm-snapshots/" | |
CHARTS_PUBLIC_RELEASES_URL: "https://helm-charts.touk.pl/nexus/repository/helm-releases/" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.setVersion.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: setVersion | |
id: setVersion | |
run: echo "::set-output name=version::$(helm show chart ${{env.CHART_SRC_DIR}} | grep ^version | sed -e "s/.*:\ //;s/SNAPSHOT/SNAPSHOT.${{github.run_id}}/")" | |
- name: buildAll | |
run: helm dependencies build ${{env.CHART_SRC_DIR}} | |
- name: packageAll | |
run: helm package ${{env.CHART_SRC_DIR}} -d dist --version "${{steps.setVersion.outputs.version}}" | |
- name: Store target | |
uses: actions/upload-artifact@v4 | |
with: | |
name: helm-build | |
path: "dist/${{env.NAME}}-${{steps.setVersion.outputs.version}}.tgz" | |
helm-test: | |
name: helm test | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: helm-build | |
path: dist | |
- uses: AbsaOSS/k3d-action@v2 | |
with: | |
cluster-name: "k3s-default" | |
args: >- | |
--config=.k3d/single-cluster.yml | |
--trace | |
- name: helmUpgrade | |
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml | |
- name: helmTestRelease | |
run: ./test.sh "${{env.RELEASE_NAME}}" | |
publish-snapshot: | |
name: publish-snapshot | |
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.head_ref, 'preview/') }} | |
runs-on: ubuntu-latest | |
needs: [ build, helm-test ] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: helm-build | |
path: dist | |
- run: curl -u ${{env.CHART_REPOSITORY_AUTH}} --fail --upload-file "dist/${{env.NAME}}-${{needs.build.outputs.version}}.tgz" ${{env.CHARTS_PUBLIC_SNAPSHOTS_URL}} | |
publish-release: | |
name: publish-release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-latest | |
needs: [ build, helm-test ] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: helm-build | |
path: dist | |
- run: curl -u ${{env.CHART_REPOSITORY_AUTH}} --fail --upload-file "dist/${{env.NAME}}-${{needs.build.outputs.version}}.tgz" ${{env.CHARTS_PUBLIC_RELEASES_URL}} |