Skip to content

Commit

Permalink
feat(ci): bump checkout action to v4 (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
DjinnS authored Oct 18, 2024
1 parent fa9b6b3 commit 04ed680
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 285 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
150 changes: 75 additions & 75 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Main Continuous Integration
on:
push:
branches:
- main
- main

permissions:
packages: write
Expand All @@ -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 }}"
Expand All @@ -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
Loading

0 comments on commit 04ed680

Please sign in to comment.