From f4fa5236ac941fcfa3809b1451c91ea209c414f3 Mon Sep 17 00:00:00 2001 From: Frank Jogeleit Date: Fri, 8 Dec 2023 21:52:01 +0100 Subject: [PATCH] WIP Signed-off-by: Frank Jogeleit --- .github/workflows/ci.yaml | 10 +++++-- .github/workflows/cr.yaml | 29 ------------------- .github/workflows/release-chart.yaml | 15 ++++++---- .../{image.yaml => release-image.yaml} | 16 +++++----- 4 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/cr.yaml rename .github/workflows/{image.yaml => release-image.yaml} (87%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2f280ca..a1ede6cc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,7 @@ on: push: branches: - main - - development + - alpha paths-ignore: - README.md @@ -22,15 +22,21 @@ jobs: - name: Set up Go 1.21 uses: actions/setup-go@v2 with: - go-version: 1.21 + go-version-file: go.mod + cache-dependency-path: go.sum + - name: Checkout code uses: actions/checkout@v2 + - name: Get dependencies run: go get -v -t -d ./... + - name: Calc coverage run: make coverage + - name: Convert coverage to lcov uses: jandelgado/gcov2lcov-action@v1.0.9 + - name: Coveralls uses: coverallsapp/github-action@v2.0.0 with: diff --git a/.github/workflows/cr.yaml b/.github/workflows/cr.yaml deleted file mode 100644 index 129ad600..00000000 --- a/.github/workflows/cr.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Release Charts - -on: - push: - branches: - - main - paths: - - 'charts/**' - - 'manifests/**' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Install Helm - uses: azure/setup-helm@v1 - - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.2.1 - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/release-chart.yaml b/.github/workflows/release-chart.yaml index 66691807..fc7bdfe6 100644 --- a/.github/workflows/release-chart.yaml +++ b/.github/workflows/release-chart.yaml @@ -1,9 +1,9 @@ -name: release +name: release-chart on: push: - branches: - - 'alpha' + tags: + - 'policy-reporter-alpha-chart-v*' jobs: helm-chart: @@ -14,6 +14,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Verify Helm Docs + run: | + set -e + make verify-helm-docs - name: Install Helm uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 with: @@ -25,11 +29,12 @@ jobs: - name: Set version run: | set -e - echo "APP_VERSION=3.0.0-alpha-${{ env.TAG }}" >> $GITHUB_ENV - echo "CHART_VERSION=3.0.0-alpha-${{ env.TAG }}" >> $GITHUB_ENV + TAG=${{ github.ref_name }} + echo "CHART_VERSION=${TAG#policy-reporter-alpha-chart--}" >> $GITHUB_ENV - name: Run chart-releaser uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 #v1.7.0 with: token: ${{ secrets.GITHUB_TOKEN }} linting: off charts_dir: charts + chart_version: ${{ env.CHART_VERSION }} diff --git a/.github/workflows/image.yaml b/.github/workflows/release-image.yaml similarity index 87% rename from .github/workflows/image.yaml rename to .github/workflows/release-image.yaml index d1590f43..19e9f34d 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/release-image.yaml @@ -1,9 +1,8 @@ -name: image +name: release-image on: push: - tags: - - v* - - dev + branches: + - alpha permissions: contents: read @@ -21,11 +20,11 @@ jobs: id: params run: | # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + VERSION=$(git rev-parse --short "$GITHUB_SHA") # Strip "v" prefix from tag name [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') echo VERSION=$VERSION - echo "::set-output name=version::$VERSION" + echo "VERSION=$VERSION" >> "$GITHUB_ENV" - name: Login to Github Packages uses: docker/login-action@v2 @@ -49,12 +48,11 @@ jobs: id: push with: push: true - platforms: linux/arm64,linux/amd64,linux/s390x + platforms: linux/arm64,linux/amd64 cache-from: type=registry,ref=ghcr.io/kyverno/policy-reporter:buildcache cache-to: type=registry,ref=ghcr.io/kyverno/policy-reporter:buildcache,mode=max tags: | - ghcr.io/kyverno/policy-reporter:latest - ghcr.io/kyverno/policy-reporter:${{ steps.params.outputs.version }} + ghcr.io/kyverno/policy-reporter:${{ env.VERSION }} - uses: CycloneDX/gh-gomod-generate-sbom@d4aee0cf5133055dbd98899978246c10c18c440f # v1.1.0 with: