feat(pencil): Add pod disruption budget (#69) #13
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: Build and Release Container and Helm Chart | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- id: github-repository | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository }} | |
- name: Set up Go ^1.21 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.21 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
- name: Unit Test | |
run: make test | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Code specific changes | |
id: code-specific-changes | |
uses: tj-actions/changed-files@v44 | |
with: | |
files_ignore: | | |
charts | |
.github | |
.run | |
- name: Automated Code Version Bump | |
if: steps.code-specific-changes.outputs.any_modified == 'true' | |
id: code-version-bump | |
uses: phips28/gh-action-bump-version@v11.0.4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
with: | |
commit-message: 'CI: Bump app version to {{version}} [skip ci]' | |
- name: Set up Docker Buildx | |
if: steps.code-specific-changes.outputs.any_modified == 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: steps.code-specific-changes.outputs.any_modified == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and push merge to main | |
if: steps.code-specific-changes.outputs.any_modified == 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ steps.github-repository.outputs.lowercase }}:${{ steps.code-version-bump.outputs.newTag }},${{ steps.github-repository.outputs.lowercase }}:latest | |
platforms: linux/amd64,linux/arm64 | |
- name: Get specific changed files | |
id: helm-specific-changes | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
charts/kubernetes-sidecar-injector/** | |
- name: Automated Helm Version Bump | |
if: steps.helm-specific-changes.outputs.any_modified == 'true' | |
id: helm-version-bump | |
uses: phips28/gh-action-bump-version@v11.0.4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
PACKAGEJSON_DIR: charts | |
with: | |
skip-tag: 'true' | |
commit-message: 'CI: Bump Helm chart version to {{version}} [skip ci]' | |
- name: Extract version from package.json | |
uses: sergeysova/jq-action@v2 | |
id: version | |
with: | |
cmd: 'jq .version package.json -r' | |
- name: update Chart.yaml | |
if: steps.helm-specific-changes.outputs.any_modified == 'true' | |
working-directory: charts/kubernetes-sidecar-injector | |
run: | | |
cat <<EOF > Chart.yaml | |
name: ${GITHUB_REPOSITORY#*/} | |
home: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | |
version: ${{ steps.helm-version-bump.outputs.newTag }} | |
apiVersion: v2 | |
appVersion: "${{ steps.version.outputs.value }}" | |
keywords: | |
- kubernetes | |
- sidecar-injection | |
sources: | |
- ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | |
EOF | |
- name: commit the new Chart.yml | |
if: steps.helm-specific-changes.outputs.any_modified == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Automated Change [skip ci] | |
- name: Install Helm | |
if: steps.helm-specific-changes.outputs.any_modified == 'true' | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.8.0 | |
- name: Run chart-releaser | |
if: steps.helm-specific-changes.outputs.any_modified == 'true' | |
uses: helm/chart-releaser-action@v1.6.0 | |
env: | |
CR_TOKEN: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" |