From 7cbcab773fde4b3823d68f1fcb190eda05dd369f Mon Sep 17 00:00:00 2001 From: Alexandros Sigaras Date: Tue, 3 Oct 2023 16:23:53 -0400 Subject: [PATCH] Add files via upload --- .../k8s-deployment-scripts-update.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/k8s-deployment-scripts-update.yml diff --git a/.github/workflows/k8s-deployment-scripts-update.yml b/.github/workflows/k8s-deployment-scripts-update.yml new file mode 100644 index 0000000..c80b44b --- /dev/null +++ b/.github/workflows/k8s-deployment-scripts-update.yml @@ -0,0 +1,54 @@ +name: k8s-deployment-scripts-update + +on: + workflow_dispatch: + inputs: + image: + description: 'Image' + required: true + tag: + description: 'Tag' + required: true + +jobs: + # Print inputs + print: + runs-on: ubuntu-latest + steps: + - name: Pring inputs + run: | + echo ${{ inputs.image }} + echo ${{ inputs.tag }} + + # Update repo eipm/k8s-deployment-scripts if version starts with v + update: + runs-on: ubuntu-latest + if: ${{ startsWith(inputs.tag, 'v') }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: k8s-deployment-scripts + ref: main + repository: eipm/k8s-deployment-scripts + token: ${{ secrets.GHCR_TOKEN }} + + - name: Update image + run: | + # Update the image version in the repo + cd k8s-deployment-scripts + echo DIRECTORY="$(pwd)" + IMAGE=${{ inputs.image }} + VERSION=$(echo ${{ inputs.tag }} | sed -e 's/^v//') + echo IMAGE=$IMAGE + echo VERSION=$VERSION + find ./ -type f -exec sed -i '' -e 's|'$IMAGE':.*|'$IMAGE:$VERSION'|g' {} \; + + - name: Commit and push to repo + run: | + cd k8s-deployment-scripts + echo DIRECTORY="$(pwd)" + git config --global user.name "eipmgithubsvc1" + git config --global user.email "eipmgithubsvc1@gmail.com" + git commit -a -m "Updated image" + git push