-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
6 changed files
with
87 additions
and
7 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
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,48 @@ | ||
name: Update helm repo | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Publish Docker image"] | ||
types: | ||
- completed | ||
jobs: | ||
update-helm-repo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install yq | ||
run: | | ||
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq | ||
sudo chmod +x /usr/bin/yq | ||
- name: Export var from config.yml | ||
run: | | ||
./latest_tag.sh | ||
- name: Export env variabels | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: '.env' | ||
|
||
- name: Checkout helm repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REPO }} | ||
|
||
- name: Update chart values.yaml | ||
run : | | ||
sudo yq -i '.deployment.tag = strenv(${{ env.LATEST_TAG }})' ${{ env.CHART }}/values.yaml | ||
- name: Debug | ||
run: | | ||
cat ${{ env.CHART }}/values.yaml | ||
- name: Push changes to chart repo | ||
run: | | ||
git config --global user.email "<EMAIL>" | ||
git config --global user.name "GitHub Action" | ||
git add ${{ env.CHART }}/values.yaml | ||
git commit -m "Update deployment image tag to ${{ env.LATEST_TAG }}" | ||
git push -f origin master |
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
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
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,21 @@ | ||
#!/bin/bash | ||
|
||
eval $(yq e '.docker | to_entries | .[] | "export \(.key)=\(.value)"' config.yml) | ||
eval $(yq e '.github-helm-repo | to_entries | .[] | "export \(.key)=\(.value)"' config.yml) | ||
|
||
DOCKER_IMAGE="$DOCKER_HUB_USERNAME/$DOCKER_REPO_NAME" | ||
|
||
TAGS=$(curl -s "https://hub.docker.com/v2/repositories/$DOCKER_IMAGE/tags/?page_size=100" | jq -r '.results[].name') | ||
|
||
LATEST_TAG=$(echo "$TAGS" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1) | ||
|
||
|
||
create_env_file() { | ||
cat << EOF > .env | ||
LATEST_TAG=$LATEST_TAG | ||
REPO=$REPO | ||
CHART=$CHART | ||
EOF | ||
} | ||
|
||
create_env_file |
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