diff --git a/.github/workflows/build-and-deploy b/.github/workflows/build-and-deploy new file mode 100644 index 000000000..e2aa37929 --- /dev/null +++ b/.github/workflows/build-and-deploy @@ -0,0 +1,57 @@ +name: app deploy to EKS +on: + pull_request: + branches: [ "master" ] + paths-ignore: + - 'DCOS/**' + - 'K8s/**' + - 'load-gen/**' + - 'OpenShift/**' + - 'Swarm/**' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install kubectl + uses: azure/setup-kubectl@v2.0 + with: + version: 'v1.24.0' # default is latest stable + id: install + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push docker image to Amazon ECR + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: robotshop + IMAGE_TAG: latest + run: | + cd web; + docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . + docker images +# docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + +# - name: Update kube config +# run: | +# mkdir -p $HOME/.kube +# echo "$KUBE_CONFIG_DATA" | base64 -d > $HOME/.kube/config +# aws eks update-kubeconfig --region us-east-1 --name mycluster +# +# - name: Deploy to EKS +# run: | +# kubectl apply -f deployment.yaml +# kubectl apply -f service.yaml +# test diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index bb3c476a5..000000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: docker-compose-actions-workflow -on: - push: - branches: - - 'master' - paths-ignore: - - 'DCOS/**' - - 'K8s/**' - - 'load-gen/**' - - 'OpenShift/**' - - 'Swarm/**' - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build the stack - run: docker-compose build