diff --git a/.github/workflows/conventional-commits.yaml b/.github/workflows/conventional-commits.yaml index cfc9062d..5cecd488 100644 --- a/.github/workflows/conventional-commits.yaml +++ b/.github/workflows/conventional-commits.yaml @@ -3,13 +3,13 @@ name: Conventional Commits check on: pull_request: branches: - - main + - main jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v3 diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index 539df24d..4803969d 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -3,14 +3,14 @@ name: Helm CI/CD on: push: branches: - - main + - main tags: - - v* + - v* pull_request: branches: - - main + - main paths: - - 'deploy/charts/**' + - "deploy/charts/**" env: CHART_NAME: burrito @@ -22,40 +22,40 @@ jobs: name: Helm Render runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - - name: Helm Render - run: helm template ${{ env.CHART_PATH }} + - name: Helm Render + run: helm template ${{ env.CHART_PATH }} helm-push: name: Helm Push runs-on: ubuntu-latest needs: helm-render steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: GHCR Login - run: echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin - - - name: Compute versions - shell: bash - run: | - CURRENT_VERSION=$(yq $CHART_PATH/Chart.yaml --expression .version) - if [[ ${{ github.event_name }} == 'pull_request' || ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'branch' ]]; then - echo "VERSION=$(echo $CURRENT_VERSION-${{ github.sha }})" >> $GITHUB_ENV - echo "APP_VERSION=${{ github.sha }}" >> $GITHUB_ENV - elif [[ ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag' ]]; then - echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/v//')" >> $GITHUB_ENV - echo "APP_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV - else - echo "Unsupported event type" - exit 1 - fi - - - name: Helm Package - run: helm package ${{ env.CHART_PATH }} -u --version ${{ env.VERSION }} --app-version ${{ env.APP_VERSION }} - - - name: Helm Push - run: helm push ./${{ env.CHART_NAME }}-${{ env.VERSION }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts + - name: Checkout + uses: actions/checkout@v4 + + - name: GHCR Login + run: echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin + + - name: Compute versions + shell: bash + run: | + CURRENT_VERSION=$(yq $CHART_PATH/Chart.yaml --expression .version) + if [[ ${{ github.event_name }} == 'pull_request' || ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'branch' ]]; then + echo "VERSION=$(echo $CURRENT_VERSION-${{ github.sha }})" >> $GITHUB_ENV + echo "APP_VERSION=${{ github.sha }}" >> $GITHUB_ENV + elif [[ ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag' ]]; then + echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/v//')" >> $GITHUB_ENV + echo "APP_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV + else + echo "Unsupported event type" + exit 1 + fi + + - name: Helm Package + run: helm package ${{ env.CHART_PATH }} -u --version ${{ env.VERSION }} --app-version ${{ env.APP_VERSION }} + + - name: Helm Push + run: helm push ./${{ env.CHART_NAME }}-${{ env.VERSION }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ec302fa4..678b40ea 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,7 +3,7 @@ name: Main Continuous Integration on: push: branches: - - main + - main permissions: packages: write @@ -17,47 +17,47 @@ jobs: name: Unit Tests runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Cache envtest binaries - uses: actions/cache@v3 - with: - path: ./bin/ - key: binaries - - name: Setup Golang - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GO_VERSION }}" - - name: Install envtest - run: make envtest - - name: Setup envtest - run: ./bin/setup-envtest use - - name: Run tests - run: make test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + - name: Checkout + uses: actions/checkout@v4 + - name: Cache envtest binaries + uses: actions/cache@v3 + with: + path: ./bin/ + key: binaries + - name: Setup Golang + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + - name: Install envtest + run: make envtest + - name: Setup envtest + run: ./bin/setup-envtest use + - name: Run tests + run: make test + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 check-codegen: name: Check Codegen runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Golang - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GO_VERSION }}" - - name: Generate manifests - run: make manifests - - name: Check nothing has changed - run: | - git diff --exit-code ./manifests + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Golang + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + - name: Generate manifests + run: make manifests + - name: Check nothing has changed + run: | + git diff --exit-code ./manifests lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: "${{ env.GO_VERSION }}" @@ -72,52 +72,52 @@ jobs: name: Build & Push runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - - name: Get Build timestamp and branch name - run: | - echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV - echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV + - name: Get Build timestamp and branch name + run: | + echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV + echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV - - name: Docker tags & labels - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/${{ github.repository }} - # generate Docker tags: - # - type=raw,VERSION -> branch name - # - type=ref,event=tag -> tag name - # - type=sha,format=long,prefix= -> commit sha - tags: | - type=raw,${{ env.VERSION }} - type=ref,event=tag - type=sha,format=long,prefix= + - name: Docker tags & labels + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + # generate Docker tags: + # - type=raw,VERSION -> branch name + # - type=ref,event=tag -> tag name + # - type=sha,format=long,prefix= -> commit sha + tags: | + type=raw,${{ env.VERSION }} + type=ref,event=tag + type=sha,format=long,prefix= - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: true - provenance: false - platforms: ${{ env.BUILD_PLATFORMS }} - build-args: | - VERSION=${{ env.VERSION }} - BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} - COMMIT_HASH=${{ github.sha }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + provenance: false + platforms: ${{ env.BUILD_PLATFORMS }} + build-args: | + VERSION=${{ env.VERSION }} + BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} + COMMIT_HASH=${{ github.sha }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2949a121..987525d4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -3,7 +3,7 @@ name: Pull Request Continuous Integration on: pull_request: branches: - - main + - main env: GO_VERSION: 1.22 @@ -14,47 +14,47 @@ jobs: name: Unit Tests runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Cache envtest binaries - uses: actions/cache@v3 - with: - path: ./bin/ - key: binaries - - name: Setup Golang - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GO_VERSION }}" - - name: Install envtest - run: make envtest - - name: Setup envtest - run: ./bin/setup-envtest use - - name: Run tests - run: make test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + - name: Checkout + uses: actions/checkout@v4 + - name: Cache envtest binaries + uses: actions/cache@v3 + with: + path: ./bin/ + key: binaries + - name: Setup Golang + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + - name: Install envtest + run: make envtest + - name: Setup envtest + run: ./bin/setup-envtest use + - name: Run tests + run: make test + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 check-codegen: name: Check Codegen runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Golang - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GO_VERSION }}" - - name: Generate manifests - run: make manifests - - name: Check nothing has changed - run: | - git diff --exit-code ./manifests + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Golang + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + - name: Generate manifests + run: make manifests + - name: Check nothing has changed + run: | + git diff --exit-code ./manifests lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: "${{ env.GO_VERSION }}" @@ -69,51 +69,51 @@ jobs: name: Build & Push runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - - name: Get Build timestamp and branch name - run: | - echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV - echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV + - name: Get Build timestamp and branch name + run: | + echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV + echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV - - name: Docker tags & labels - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/${{ github.repository }} - # generate Docker tags: - # - type=raw,VERSION -> branch name - # - type=ref,event=tag -> tag name - # - type=sha,format=long,prefix= -> commit sha - tags: | - type=raw,${{ env.VERSION }} - type=ref,event=tag - type=sha,format=long,prefix= + - name: Docker tags & labels + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + # generate Docker tags: + # - type=raw,VERSION -> branch name + # - type=ref,event=tag -> tag name + # - type=sha,format=long,prefix= -> commit sha + tags: | + type=raw,${{ env.VERSION }} + type=ref,event=tag + type=sha,format=long,prefix= - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v4 - with: - provenance: false - platforms: ${{ env.BUILD_PLATFORMS }} - build-args: | - VERSION=${{ env.VERSION }} - BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} - COMMIT_HASH=${{ github.sha }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build and push + uses: docker/build-push-action@v4 + with: + provenance: false + platforms: ${{ env.BUILD_PLATFORMS }} + build-args: | + VERSION=${{ env.VERSION }} + BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} + COMMIT_HASH=${{ github.sha }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7ee260bb..ae1ed5eb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - 'v*' + - "v*" env: GO_VERSION: 1.22 @@ -18,34 +18,34 @@ jobs: runs-on: ubuntu-latest environment: production steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - name: Fetch all tags - run: git fetch --force --tags - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GO_VERSION }}" - - - name: Get ldflags env values - run: | - echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV - echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV - echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + + - name: Fetch all tags + run: git fetch --force --tags + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "${{ env.GO_VERSION }}" + + - name: Get ldflags env values + run: | + echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV + echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV + echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} version: runs-on: ubuntu-latest @@ -53,79 +53,79 @@ jobs: env: CHART_PATH: ./deploy/charts/burrito steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: main - - - name: Bump VERSION file - run: | - echo ${{ github.ref_name }} > VERSION - - - name: Bump Helm Chart versions - run: | - export CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g') - export APP_VERSION=${{ github.ref_name }} - yq -i '.version = env(CHART_VERSION)' $CHART_PATH/Chart.yaml - yq -i '.appVersion = env(APP_VERSION)' $CHART_PATH/Chart.yaml - - - name: Commit version to repository - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "chore(release): bump version to ${{ github.ref_name }}" - push_options: --force + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: main + + - name: Bump VERSION file + run: | + echo ${{ github.ref_name }} > VERSION + + - name: Bump Helm Chart versions + run: | + export CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g') + export APP_VERSION=${{ github.ref_name }} + yq -i '.version = env(CHART_VERSION)' $CHART_PATH/Chart.yaml + yq -i '.appVersion = env(APP_VERSION)' $CHART_PATH/Chart.yaml + + - name: Commit version to repository + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "chore(release): bump version to ${{ github.ref_name }}" + push_options: --force build-and-push: name: Build & Push runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Get Build timestamp and branch name - run: | - echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV - echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV - - - name: Docker tags & labels - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/${{ github.repository }} - # generate Docker tags: - # - type=raw,VERSION -> branch name - # - type=ref,event=tag -> tag name - # - type=sha,format=long,prefix= -> commit sha - tags: | - type=raw,${{ env.VERSION }} - type=ref,event=tag - type=sha,format=long,prefix= - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: true - provenance: false - platforms: ${{ env.BUILD_PLATFORMS }} - build-args: | - VERSION=${{ env.VERSION }} - BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} - COMMIT_HASH=${{ github.sha }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Checkout + uses: actions/checkout@v4 + + - name: Get Build timestamp and branch name + run: | + echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV + echo "VERSION=$( echo ${{ github.head_ref || github.ref_name }} | tr '/' '-' )" >> $GITHUB_ENV + + - name: Docker tags & labels + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + # generate Docker tags: + # - type=raw,VERSION -> branch name + # - type=ref,event=tag -> tag name + # - type=sha,format=long,prefix= -> commit sha + tags: | + type=raw,${{ env.VERSION }} + type=ref,event=tag + type=sha,format=long,prefix= + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: true + provenance: false + platforms: ${{ env.BUILD_PLATFORMS }} + build-args: | + VERSION=${{ env.VERSION }} + BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} + COMMIT_HASH=${{ github.sha }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max