Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release Charts

on:
push:
branches:
- master
paths:
- 'deployments/kubernetes/**'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Install yq
uses: mikefarah/yq@v4

Comment on lines +28 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix: yq action is misused; subsequent yq -i will fail.

uses: mikefarah/yq@v4 does not “install” yq for later steps; it executes yq via its own cmd: input. The current setup likely fails at Line 48 because yq isn’t on PATH. Use the action to run the edit, and export APPVERSION once when deriving it from the tag.

Apply:

@@
-      - name: Install yq
-        uses: mikefarah/yq@v4
+      # (remove separate install; we'll invoke yq via its action below)
@@
       - name: Get last Git tag
         id: get_tag
         # Forks will not have tags, so it won't change the version
         run: |
           TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
           echo "tag=$TAG" >> $GITHUB_OUTPUT
+          # Derive app version once and export for later steps
+          APPVERSION="${TAG#v}"
+          echo "APPVERSION=$APPVERSION" >> $GITHUB_ENV
@@
-      - name: Update appVersion in Chart.yaml for release
-        if: steps.get_tag.outputs.tag != ''
-        run: |
-          FILE="deployments/kubernetes/sms-gateway-server/Chart.yaml"
-          TAG="${{ steps.get_tag.outputs.tag }}"
-
-          # Strip leading 'v' if present
-          APPVERSION="${TAG#v}"
-
-          echo "Temporarily updating appVersion in $FILE to $APPVERSION for release"
-          yq -i ".appVersion = \"$APPVERSION\"" "$FILE"
+      - name: Update appVersion in Chart.yaml for release
+        if: steps.get_tag.outputs.tag != ''
+        uses: mikefarah/yq@v4
+        env:
+          FILE: deployments/kubernetes/sms-gateway-server/Chart.yaml
+        with:
+          cmd: yq -i '.appVersion = strenv(APPVERSION)' "$FILE"

Also applies to: 38-49

🤖 Prompt for AI Agents
.github/workflows/build-chart.yaml lines 28-30 (also applies to 38-49): the
workflow wrongly uses "uses: mikefarah/yq@v4" as if it installs yq to PATH for
later steps, which causes later "yq -i" invocations to fail; replace the
separate install step by invoking the mikefarah/yq action with its "cmd" input
to perform the in-place edits (or install yq via apt/npm if you truly need it on
PATH), and when extracting APPVERSION from the tag compute and export APPVERSION
once (export APPVERSION=<value>) so subsequent steps can reuse it instead of
recalculating; update the affected steps so they either run yq edits via the
action or ensure a real yq binary is installed and APPVERSION is exported as an
environment variable.

- name: Get last Git tag
id: get_tag
# Forks will not have tags, so it won't change the version
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
echo "tag=$TAG" >> $GITHUB_OUTPUT

- name: Update appVersion in Chart.yaml for release
if: steps.get_tag.outputs.tag != ''
run: |
FILE="deployments/kubernetes/sms-gateway-server/Chart.yaml"
TAG="${{ steps.get_tag.outputs.tag }}"

# Strip leading 'v' if present
APPVERSION="${TAG#v}"

echo "Temporarily updating appVersion in $FILE to $APPVERSION for release"
yq -i ".appVersion = \"$APPVERSION\"" "$FILE"

- name: Run chart-releaser
id: cr
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
charts_dir: ./deployments/kubernetes
23 changes: 23 additions & 0 deletions deployments/kubernetes/sms-gateway-server/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
17 changes: 17 additions & 0 deletions deployments/kubernetes/sms-gateway-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: sms-gateway-server
description: A Helm chart for Kubernetes to deploy sms-gateway-server.

type: application

version: 0.2.11

# appVersion is always updated in CI
appVersion: "latest"

home: https://github.com/android-sms-gateway/server
sources:
- https://github.com/android-sms-gateway/server
maintainers:
- name: SMSGate Team
email: [email protected]
Loading