Merge pull request #21 from qcohq/dev #51
This file contains hidden or 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: Deploy Web | |
on: | |
push: | |
branches: [main] | |
env: | |
IMAGE_NAME: web | |
CR_REGISTRY: crpahb1mqno377fg9i7a | |
CI: 'true' | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
IMAGE_TAG: ${{ github.sha }} | |
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }} | |
POSTGRES_URL: ${{ secrets.POSTGRES_URL }} | |
jobs: | |
# Deploy to EKS | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Update submodules | |
run: git submodule update --init --recursive | |
- name: Login to Container Registry | |
id: login-cr | |
uses: yc-actions/yc-cr-login@v2 | |
with: | |
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} | |
- name: Build image | |
run: | | |
docker build . --file apps/web/Dockerfile --tag $IMAGE_NAME \ | |
--build-arg BETTER_AUTH_SECRET=$BETTER_AUTH_SECRET \ | |
--build-arg POSTGRES_URL=$POSTGRES_URL | |
- name: Push Image | |
run: | | |
IMAGE_ID=cr.yandex/$CR_REGISTRY/$IMAGE_NAME | |
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_TAG | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker push $IMAGE_ID:latest | |
docker push $IMAGE_ID:$IMAGE_TAG | |
- name: Deploy To Cluster | |
uses: kodermax/kubectl-aws-eks@v1 | |
with: | |
args: set image deployment/$IMAGE_NAME $IMAGE_NAME=cr.yandex/$CR_REGISTRY/$IMAGE_NAME:$IMAGE_TAG |