Skip to content

Commit

Permalink
feat: Add gh action to build and deploy container
Browse files Browse the repository at this point in the history
  • Loading branch information
nezort11 committed Jan 4, 2025
1 parent ddcaa50 commit 0a71574
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and Deploy to Yandex Cloud Serverless Containers

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Login to Yandex Cloud Container Registry
id: login-cr
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}

- name: Build, tag, and push image to Yandex Cloud Container Registry
env:
CR_REGISTRY: $REGISTRY_ID
CR_REPOSITORY: $CONTAINER_NAME
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG .
docker push cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG
- name: Deploy Serverless Container
id: deploy-sls-container
uses: yc-actions/yc-sls-container-deploy@v2
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
revision-service-account-id: ajeqnasj95o7********
revision-image-url: cr.yandex/crp00000000000000000/my-cr-repo:${{ github.sha }}
container-name: yc-action-demo
folder-id: bbajn5q2d74c********
revision-cores: 1
revision-memory: 512Mb
revision-core-fraction: 100
revision-concurrency: 8
revision-execution-timeout: 10

0 comments on commit 0a71574

Please sign in to comment.