Skip to content

Commit 977e62b

Browse files
committed
fix: github actions for updating the chart repo
1 parent 27ad984 commit 977e62b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
run: |
5454
vendor/bin/psalm
5555
vendor/bin/phpcs
56+
5657
images:
5758
runs-on: ubuntu-latest
5859
needs: quality
@@ -106,3 +107,38 @@ jobs:
106107
ghcr.io/aulasoftwarelibre/lock-httpd:${{ steps.extract_tag.outputs.tag }}
107108
cache-from: type=local,src=/tmp/.buildx-cache
108109
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
110+
111+
update-manifest:
112+
runs-on: ubuntu-latest
113+
needs: images
114+
if: github.event_name == 'push' && github.repository == 'aulasoftwarelibre/lock' && (startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/tags/v') )
115+
steps:
116+
- name: Extract tag name
117+
id: extract_tag
118+
run: echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
119+
120+
- name: Checkout config repository (aulasoftwarelibre/charts)
121+
uses: actions/checkout@v4
122+
with:
123+
repository: aulasoftwarelibre/charts
124+
path: charts
125+
token: ${{ secrets.CHARTS_REPO_PAT }}
126+
127+
- name: Update image tag in manifests
128+
run: |
129+
TAG="${{ steps.extract_tag.outputs.tag }}"
130+
sed -i "s|image: ghcr.io/aulasoftwarelibre/lock-php:.*|image: ghcr.io/aulasoftwarelibre/lock-php:$TAG|g" charts/lock/php-deployment.yaml
131+
sed -i "s|image: ghcr.io/aulasoftwarelibre/lock-httpd:.*|image: ghcr.io/aulasoftwarelibre/lock-httpd:$TAG|g" charts/lock/httpd-deployment.yaml
132+
133+
- name: Commit and push changes
134+
run: |
135+
cd charts
136+
git config --global user.name "github-actions[bot]"
137+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
138+
git add .
139+
if ! git diff --staged --quiet; then
140+
git commit -m "ci: Update lock images to tag ${{ steps.extract_tag.outputs.tag }}"
141+
git push
142+
else
143+
echo "No changes to commit. El YAML ya estaba actualizado."
144+
fi

0 commit comments

Comments
 (0)