-
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
2 changed files
with
69 additions
and
42 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,62 @@ | ||
name: Argo Deploy 🚀 | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
namespace: | ||
description: "The Kubernetes namespace to deploy to" | ||
required: true | ||
type: string | ||
image: | ||
description: "Docker image with tag to update in values file" | ||
required: true | ||
type: string | ||
secrets: | ||
GH_TOKEN: | ||
description: "GitHub Token for accessing private repos" | ||
required: true | ||
|
||
jobs: | ||
argo-deploy: | ||
name: Deploy 🚀 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code from another repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kennyd3d/argo-deployments | ||
path: ./argo-deployments | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Force update local branch with remote | ||
working-directory: ./argo-deployments | ||
run: | | ||
git fetch origin main | ||
git reset --hard origin/main | ||
git clean -fd | ||
- name: Update image tag in values.yaml | ||
working-directory: ./argo-deployments | ||
run: | | ||
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\ | ||
sudo chmod +x /usr/bin/yq | ||
yq e -i '.environments.${{ inputs.namespace }}.image = "${{ inputs.image }}"' ./hello-world-app/values-${{ inputs.namespace }}.yaml | ||
- name: Commit files | ||
working-directory: ./argo-deployments | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add . | ||
git commit -m "[BOT] Update k8 deployment" || echo "No changes to commit" | ||
- name: Pull the latest changes from main | ||
working-directory: ./argo-deployments | ||
run: | | ||
git pull origin main --rebase | ||
- name: Push changes | ||
working-directory: ./argo-deployments | ||
run: | | ||
git push origin main --force-with-lease |
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