From 815a93fb9f0d7a677840316a424352d06d32a03d Mon Sep 17 00:00:00 2001 From: Aditya Pradana <97273475+adityap1337@users.noreply.github.com> Date: Tue, 27 Dec 2022 13:36:36 +0800 Subject: [PATCH] add deploy to eks cronjob --- .github/workflows/deploy-aws-cronjob.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/deploy-aws-cronjob.yml diff --git a/.github/workflows/deploy-aws-cronjob.yml b/.github/workflows/deploy-aws-cronjob.yml new file mode 100644 index 0000000..ee47838 --- /dev/null +++ b/.github/workflows/deploy-aws-cronjob.yml @@ -0,0 +1,49 @@ +name: Deploy to Kube AWS Cronjob + +on: + workflow_call: + inputs: + app-name: + required: true + type: string + app-target: + required: true + type: string + image-tag: + required: true + type: string + secrets: + REGISTRY: + required: true + EKS_KEY: + required: true + EKS_SECRET: + required: true + +jobs: + deploy-k8s-eks-cron: + name: Deploy Cronjob + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{secrets.EKS_KEY}} + aws-secret-access-key: ${{secrets.EKS_SECRET}} + aws-region: ap-southeast-3 + - name: Deploy + env: + REGISTRY: ${{ secrets.REGISTRY }} + APP: ${{ inputs.app-name }} + APPTARGET: ${{inputs.app-target}} + TAG: ${{inputs.image-tag}} + run: | + curl -o kubectl https://s3.us-west-2.amazonaws.com/amazon-eks/1.24.7/2022-10-31/bin/linux/amd64/kubectl + chmod +x kubectl + mv kubectl /usr/local/bin/ + cd ~ + mkdir .kube + aws eks update-kubeconfig --region ap-southeast-3 --name production-clusters + kubectl set image cronjob/$APP $APPTARGET=$REGISTRY:$TAG