-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b771e2d
commit 5a9e03d
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |