Merge pull request #10 from Dyakovvn/main #10
Workflow file for this run
This file contains hidden or 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: goreleaser | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Resolve IMAGE_REPO | |
| run: | | |
| OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]') | |
| echo "IMAGE_REPO=ghcr.io/${OWNER}/rbs-csi-driver" >> "$GITHUB_ENV" | |
| - name: Run GoReleaser for tag | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| version: latest | |
| args: release --clean | |
| env: | |
| GORELEASER_CURRENT_TAG: ${{ github.ref_name }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| IMAGE_REPO: ${{ env.IMAGE_REPO }} | |
| - name: Clear | |
| if: always() | |
| run: rm -f "${HOME}/.docker/config.json" | |
| kind-test: | |
| needs: goreleaser | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: azure/setup-kubectl@v4 | |
| - uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.17.3 | |
| - name: Set up kind cluster | |
| uses: helm/kind-action@v1 | |
| - name: Resolve IMAGE_REPO | |
| run: | | |
| OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]') | |
| echo "IMAGE_REPO=ghcr.io/${OWNER}/rbs-csi-driver" >> "$GITHUB_ENV" | |
| - name: Template Helm Chart | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| helm template rbs-csi ./charts/serverscom-rbs-csi \ | |
| --namespace kube-system \ | |
| --set api.token=dummy \ | |
| --set-string controller.driver.image.repository="${IMAGE_REPO}" \ | |
| --set-string node.driver.image.repository="${IMAGE_REPO}" \ | |
| --set-string controller.driver.image.tag="${TAG}" \ | |
| --set-string node.driver.image.tag="${TAG}" \ | |
| > rbs-csi.yaml | |
| - name: Verify deployment | |
| run: | | |
| kubectl apply --namespace kube-system -f rbs-csi.yaml | |
| kubectl wait --namespace kube-system \ | |
| pod -l app=rbs-csi-controller \ | |
| --for=condition=Ready --timeout=300s | |
| kubectl wait --namespace kube-system \ | |
| pod -l app=rbs-csi-node \ | |
| --for=condition=Ready --timeout=300s | |
| chart-release: | |
| needs: kind-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: yq - portable yaml processor (v4.53.2) | |
| uses: mikefarah/yq@751d8ad57b84f1794661bc70c0afb92a22ad7b3c | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.17.3 | |
| - name: Resolve release variables | |
| run: | | |
| OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]') | |
| { | |
| echo "OWNER=${OWNER}" | |
| echo "CHART_VERSION=${GITHUB_REF_NAME#v}" | |
| } >> "$GITHUB_ENV" | |
| - name: Pin chart version to tag | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| set -euo pipefail | |
| yq -i ".version = \"${CHART_VERSION}\" | .appVersion = \"${TAG}\"" charts/serverscom-rbs-csi/Chart.yaml | |
| - name: Render deploy manifest | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: bash scripts/helm-render.sh | |
| - name: Login to GHCR | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - name: Package chart and Push to GHCR | |
| run: | | |
| helm package charts/serverscom-rbs-csi --version "${CHART_VERSION}" | |
| helm push "serverscom-rbs-csi-${CHART_VERSION}.tgz" "oci://ghcr.io/${OWNER}/charts" | |
| - name: Upload deploy manifest to chart release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ github.ref_name }} | |
| run: gh release upload "${TAG}" rbs-csi-deploy.yaml --clobber | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ github.ref_name }} | |
| run: gh release edit "${TAG}" --draft=false --latest |