From 74c267a2235a5bbdce04b80680f4c5b878e956ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingvar=20Sigur=C3=B0sson?= Date: Mon, 24 Feb 2025 14:39:42 +0000 Subject: [PATCH] feat(ci): Change implementation to use composite action --- .github/actions/update-helm-values/action.yml | 42 +++++++++++++++++++ .github/workflows/update-helm-values.yml | 31 ++------------ 2 files changed, 46 insertions(+), 27 deletions(-) create mode 100644 .github/actions/update-helm-values/action.yml diff --git a/.github/actions/update-helm-values/action.yml b/.github/actions/update-helm-values/action.yml new file mode 100644 index 0000000000000..97d72488cb6be --- /dev/null +++ b/.github/actions/update-helm-values/action.yml @@ -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 "ci@island.is" + git config --global user.name "CI Bot" + + git add . + git commit -m "Updated helm charts" + echo "Showing changeset\n $(git show)" diff --git a/.github/workflows/update-helm-values.yml b/.github/workflows/update-helm-values.yml index 1f7341e8335f8..764e0a56647c0 100644 --- a/.github/workflows/update-helm-values.yml +++ b/.github/workflows/update-helm-values.yml @@ -1,8 +1,5 @@ on: - push: - branches: - - 'feature/update-helm-values' - # TODO: insert - main and - release/* + push: {} defaults: run: shell: bash @@ -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 "ci@island.is" - 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'