chore: autopublish 2024-12-02T10:23:22Z #228
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: push-dev | |
on: | |
push: | |
branches: | |
- dev | |
paths-ignore: | |
- '.github/**' | |
jobs: | |
push-dev: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} # checkout the correct branch name | |
fetch-depth: 0 # fetch the whole repo history | |
- name: Git Version | |
id: auto_version | |
uses: codacy/git-version@2.8.0 | |
with: | |
prefix: v | |
minor-identifier: /feat(ure)*:/ | |
major-identifier: /breaking:/ | |
- name: Set package version | |
id: version | |
run: | | |
if [[ $INPUT_VERSION ]]; then | |
echo "version=$INPUT_VERSION" >> $GITHUB_OUTPUT | |
else | |
echo "version=${{ steps.auto_version.outputs.version }}" >> $GITHUB_OUTPUT | |
fi | |
# DOCKER BUILD & PUSH | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
registry: quay.io | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
pull: true | |
tags: '${{ secrets.DOCKER_REGISTRY_NAME }}/csi-wekafs:${{ steps.auto_version.outputs.version }}' | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: | | |
revision=${{ steps.auto_version.outputs.version }} | |
quay.expires-after=14d | |
provenance: false # https://issues.redhat.com/browse/PROJQUAY-5013 quay doesn't support it | |
build-args: | | |
VERSION='${{ steps.auto_version.outputs.version }}' | |
platforms: linux/amd64,linux/arm64 | |
# HELM | |
- name: Get Helm chart version | |
id: helm_version | |
run: | | |
out="$(echo "${{ steps.auto_version.outputs.version }}" | sed 's/^v//1')" | |
echo "helm_version=$out" >> $GITHUB_OUTPUT | |
- name: Update Helm chart version | |
uses: mikefarah/yq@master | |
with: | |
cmd: | | |
BASEDIR=charts/csi-wekafsplugin | |
DRIVER_VERSION="$(echo ${{ steps.version.outputs.version }} | sed 's/^v//1')" | |
CHART_VERSION="${{ steps.helm_version.outputs.helm_version }}" | |
APP_VERSION="${{ steps.version.outputs.version }}" | |
yq -i '.version = "'$CHART_VERSION'"' $BASEDIR/Chart.yaml | |
yq -i '.appVersion = "'$APP_VERSION'"' $BASEDIR/Chart.yaml | |
yq -i '.sources[0] = "https://github.com/weka/csi-wekafs/tree/v$CHART_VERSION/charts/csi-wekafsplugin"' $BASEDIR/Chart.yaml | |
yq -i '.csiDriverVersion = "'$DRIVER_VERSION'"' $BASEDIR/values.yaml | |
echo ------------------ values ------------------ | |
cat $BASEDIR/values.yaml | |
echo --------------------chart ------------------ | |
cat $BASEDIR/Chart.yaml | |
- name: helm-docs | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: jnorwood/helm-docs:latest | |
options: -v ${{ github.workspace }}:/data | |
run: | | |
cd /data | |
helm-docs -s file -c charts -o ../../README.md -t ../README.md.gotmpl | |
helm-docs -s file -c charts | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.10.0 | |
- name: update Helm schema | |
run: | | |
helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git | |
helm schema-gen charts/csi-wekafsplugin/values.yaml >| charts/csi-wekafsplugin/values.schema.json | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
# TEST CHART | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2.6.1 | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --chart-dirs charts --target-branch ${{ github.event.repository.default_branch }}) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Run chart-testing (lint) | |
run: ct lint --chart-dirs charts --all --debug --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }} | |
- name: Create kind cluster | |
uses: helm/kind-action@v1.10.0 | |
if: steps.list-changed.outputs.changed == 'true' | |
- name: Run chart-testing (install) | |
id: helm-test | |
run: | | |
ct install --print-config --chart-dirs charts --all --debug --helm-extra-args "--timeout 60s" && \ | |
echo "passed=true" >> $GITHUB_OUTPUT | |
if: steps.list-changed.outputs.changed == 'true' | |
# PUSH CHANGES BACK TO BRANCH | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
author_name: Weka CSI Bot | |
author_email: botty@weka.io | |
github_token: ${{ secrets.BOTTY_GH_TOKEN }} | |
branch: dev | |
if: | | |
steps.helm-test.outputs.passed == 'true' |