ArgoCD workflow #15
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
name: ArgoCD workflow | |
on: | |
workflow_run: | |
workflows: ["Terraform workflow"] | |
types: | |
- completed | |
push: | |
paths: | |
- 'argocd/**' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check if triggered by main branch | |
id: check_branch | |
run: | | |
if [[ "${{ github.event.workflow_run.head_branch }}" != "main" ]]; then | |
echo "This workflow was not triggered by the main branch. Exiting." | |
exit 1 | |
fi | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} | |
- name: Install kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/ | |
- name: Update kubeconfig | |
run: aws eks --region eu-west-1 update-kubeconfig --name main-eks-cluster | |
- name: Deploy application | |
run: kubectl apply -f argocd/config/argocd-app.yaml | |