Skip to content

Commit

Permalink
feat(ci): Change implementation to use composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingvar Sigurðsson committed Feb 24, 2025
1 parent 3f0a217 commit 74c267a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 27 deletions.
42 changes: 42 additions & 0 deletions .github/actions/update-helm-values/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Update helm-values charts'
description: 'Copys the changeset in charts folder to helm-values repository'

inputs:
files:
description: 'Comma seperated string of paths to copy'
required: true

runs:
using: 'composite'
steps:
- name: Checkout helm-values repository
uses: actions/checkout@v4
with:
repository: island-is/helm-values
ref: main
# This token needs to be updated with a PAT token from dirtybot
token: ${{ secrets.GH_HELM_VALUES_PAT }}
path: helm-values
- name: Copy affected helm charts from island.is repository to helm-values repository
shell: bash
run: |
# TODO: Only copy the affected files in charts folder.
# Should be available through the work that Lommi is working on.
IFS=$IFS,
paths=()
read -a paths <<< $files
echo "$files\n$paths"
for path in ${paths[@]}; do
echo "Copying filepath: ${path}"
cp island-is/"$path" helm-values/charts/
done
- name: Commit and push changes to helm-values repository
shell: bash
run: |
cd helm-values
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
git add .
git commit -m "Updated helm charts"
echo "Showing changeset\n $(git show)"
31 changes: 4 additions & 27 deletions .github/workflows/update-helm-values.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
on:
push:
branches:
- 'feature/update-helm-values'
# TODO: insert - main and - release/*
push: {}
defaults:
run:
shell: bash
Expand All @@ -17,27 +14,7 @@ jobs:
with:
fetch-depth: 1
path: island.is
- name: Checkout helm-values repository
uses: actions/checkout@v4
- name: Update helm-values repository
uses: island.is/.github/actions/update-helm-values
with:
repository: island-is/helm-values
ref: main
token: ${{ secrets.GH_HELM_VALUES_PAT }}
path: helm-values
- name: Copy helm charts to helm-values repository
run: |
echo "$(ls -alh)"
echo "$(ls -alh island.is/)"
echo "$(ls -alh helm-values/)"
cp -R island.is/charts/* helm-values/charts/
- name: Commit and push changes to helm-values repository
run: |
cd helm-values
git config --global user.email "[email protected]"
git config --global user.name "CI Bot"
git add .
git commit -m "Updated helm charts"
echo "Showing changeset\n $(git show)"
echo "Done commiting"
# git push
files: 'charts/islandis-services/air-discount-scheme-backend/values.dev.yaml,charts/islandis-services/air-discount-scheme-web/values.dev.yaml'

0 comments on commit 74c267a

Please sign in to comment.