feat: add helm chart (#44) #1
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: Helm Chart Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "main" | |
- "release-*" | |
concurrency: | |
group: helm-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract tag | |
id: extract_tag | |
run: | | |
tag=$(if [[ ${{github.ref_name}} == v* ]];then echo "${{github.ref_name}}"; else echo "latest"; fi) | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
outputs: | |
tag: ${{ steps.extract_tag.outputs.tag }} | |
helm-build: | |
runs-on: ubuntu-latest | |
needs: | |
- prepare | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
cache: "maven" | |
- name: Create Helm | |
run: | | |
## Set -Dquarkus.container-image.tag as empty to remove the "v" prefix from the container image of Deployment | |
mvn package -DskipTests -Dquarkus.container-image.tag= | |
# YQ | |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq | |
sudo chmod +x /usr/bin/yq | |
APP_IMAGE_TAG=$TAG yq e -i '.appVersion=strenv(APP_IMAGE_TAG)' target/helm/Chart.yaml | |
env: | |
TAG: ${{ needs.prepare.outputs.tag }} | |
- name: Git add Helm | |
id: git-add-helm | |
continue-on-error: true | |
run: | | |
cp -R target/helm/ ./ | |
if [ -z $(git status --porcelain) ]; then | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
else | |
echo git status | |
git add helm/* | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit and Push | |
uses: trustification/release-tools/.github/actions/commit@main | |
if: steps.git-add-helm.outputs.has_changes == 'true' | |
with: | |
commit_message: "🔅 Helm chart update" | |
branch: ${{github.ref_name}} |