Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Tutorials
    • All tutorials
    • URL shortener
    • Ingesting data into storage systems
    • Storing application runtime logs
    • Deploying a web application using the Java Servlet API
    • Developing a Slack bot
    • Developing a Telegram bot
    • Developing a Telegram bot with AI agent support
    • Developing a custom integration in API Gateway
    • Developing CRUD APIs for movie services
    • Building a CI/CD pipeline in GitLab
    • GitLab Runner execution in Serverless Containers
    • Configuring CI/CD between Cloud Functions and SourceCraft
    • Configuring CI/CD between Cloud Functions and GitHub
    • Setting up CI/CD in SourceCraft to deploy an application in Serverless Containers using GitHub Actions
    • Working with an API gateway via WebSocket
    • Building an interactive serverless application using WebSocket
    • Automatically copying objects from one Object Storage bucket to another
    • Visualizing logs in Grafana using the Cloud Logging plugin
    • Canary release of Cloud Functions
    • Interactive debugging of Cloud Functions
    • Creating a Node.js function using TypeScript
    • Running a containerized app in Serverless Containers
    • Streaming Yandex Cloud Postbox events to Data Streams and analyzing them with DataLens
    • Using API Gateway to set up speech synthesis in SpeechKit
    • Connecting to YDB from a Cloud Functions function in Python
    • Connecting to a YDB database from a Cloud Functions function in Node.js
    • API Gateway protection with Smart Web Security
    • Deploying a web app with JWT authorization in API Gateway and authentication in Firebase
    • Automatic data upload to Yandex SpeechSense using Yandex Workflows
    • Configuring responses in Cloud Logging and Yandex Cloud Functions
    • Setting up Workflows integration with Tracker, YandexGPT, and Yandex Cloud Postbox
    • Developing functions in Functions Framework and deploying them to Yandex Serverless Containers
    • Creating a Yandex Cloud Postbox address and checking domain ownership with Terraform
    • Creating an AI agent with Yandex Cloud Functions
    • Configuring Postfix to send emails via Yandex Cloud Postbox
    • Yandex Cloud Postbox integration with external systems via webhooks

In this article:

  • Create a service account
  • Create a registry
  • Create a repository
  • Create a service connection
  • Configure CI/CD
  • Test CI/CD
  • Make sure the container has been created
  • Delete the resources you created
  • See also
  1. Serverless technologies
  2. Setting up CI/CD in SourceCraft to deploy an application in Serverless Containers using GitHub Actions

Setting up CI/CD in SourceCraft to deploy an application to Yandex Serverless Containers using GitHub Actions

Written by
Yandex Cloud
Updated at November 12, 2025
  • Create a service account
  • Create a registry
  • Create a repository
  • Create a service connection
  • Configure CI/CD
  • Test CI/CD
  • Make sure the container has been created
  • Delete the resources you created
  • See also

In this tutorial, you will set up a CI/CD process to deploy a containerized application to Serverless Containers from a SourceCraft repository using GitHub Actions. The integration between SourceCraft and Yandex Cloud will be implemented using a service connection.

Warning

To create a service connection, you need the Organization owner (organization-manager.organizations.owner) role.

To set up CI/CD to deploy an application to Serverless Containers from aSourceCraft repository using GitHub Actions:

  1. Create a service account.
  2. Create a registry.
  3. Create a repository.
  4. Create a service connection.
  5. Configure CI/CD.
  6. Test CI/CD.
  7. Make sure the container has been created.

If you no longer need the resources you created, delete them.

Required paid resourcesRequired paid resources

The infrastructure support cost includes:

  • Fee for storing the created Docker images (see Container Registry pricing.
  • Fee for the number of container invocations, computing resources allocated to the application, and outgoing traffic (see Serverless Containers pricing.

Create a service accountCreate a service account

You will use this service account to upload Docker images to registries in Yandex Container Registry and deploy containers to Serverless Containers.

Management console
CLI
API
  1. Log in to the Yandex Cloud management console.

  2. On the left side of the screen, click the line with the name of the folder where you want to deploy your container.

  3. In the list of services, select Identity and Access Management.

  4. Click Create service account.

  5. In the Name field, specify github-action.

  6. Click Add role and select these roles:

    • container-registry.images.pusher: To work with Docker images in a registry.
    • serverless-containers.editor: To manage the container.
    • iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry.
  7. Click Create.

  1. Create a service account:

    yc iam service-account create \
      --name github-action
      --folder-name <folder_name>
    

    Result:

    id: ajeab0cnib1p********
    folder_id: b0g12ga82bcv********
    created_at: "2025-10-03T09:44:35.989446Z"
    name: github-action
    
  2. Assign the service account the following roles for the folder:

    • iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry:

      yc resource-manager folder add-access-binding <folder_name> \
        --service-account-name github-action \
        --role iam.serviceAccounts.user \
        --folder-name <folder_name>
      
    • serverless-containers.editor: To manage the container:

      yc resource-manager folder add-access-binding <folder_name> \
        --service-account-name github-action \
        --role serverless-containers.editor \
        --folder-name <folder_name>
      
    • container-registry.images.pusher: To work with Docker images in the registry:

      yc resource-manager folder add-access-binding <folder_name> \
        --service-account-name github-action \
        --role container-registry.images.pusher \
        --folder-name <folder_name>
      
  1. Create a service account named github-action. To do this, use the create REST API method for the ServiceAccount resource or the ServiceAccountService/Create gRPC API call.

  2. Assign the service account these roles for the current folder:

    • iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry.
    • serverless-containers.editor: To manage the container.
    • container-registry.images.pusher: To work with Docker images in the registry.

    To do this, use the setAccessBindings REST API method for the Folder resource or the FolderService/SetAccessBindings gRPC API call.

Create a registryCreate a registry

The registry in Container Registry will house the application’s Docker image.

Management console
CLI
API
  1. In the management console, select Container Registry.
  2. Click Create registry.
  3. Specify github-action as the registry name.
  4. Click Create registry.
  5. Save the new registry’s ID, you will need it later.

Create a registry named github-action:

yc container registry create --name github-action

Result:

id: crpd50616s9a********
folder_id: b1g88tflru0e********
name: github-action
status: ACTIVE
created_at: "2025-10-03T10:34:06.601Z"

Save the new registry’s ID, you will need it later.

Use the create REST API method for the Registry resource or the RegistryService/CreateRegistryRequest gRPC API call.

Save the new registry’s ID, you will need it later.

Create a repositoryCreate a repository

The repository will be created from the yc-ci-cd-serverless template and store the Dockerfile, auxiliary files for creating the Docker image, and the CI/CD process settings.

SourceCraft UI
  1. Open the service home page.

  2. In the left-hand panel, click Create repository.

  3. In the window that opens, select Blank repository.

  4. Under Your new repository details:

    • In the Owner field, select the organization in which you created the Yandex Cloud service account.

    • In the Name field, specify a name for the repository.

      The name must be unique within the organization. The name may contain the following ASCII characters: lowercase and uppercase Latin letters, numbers, commas, hyphens, and underscores.

      The address to access the repository at is displayed below the name.

    • Optionally, in the Description field, enter a description for the repository.

  5. Under Repository template, click Browse templates, select the yc-ci-cd-serverless template, and click Use template.

    To view the template contents, click Preview.

    The template contains:

    • .sourcecraft/ci.yaml file with a pre-installed configuration of the CI/CD process that runs when a commit is created and does the following:
      • Obtains a Yandex Cloud IAM token using a service connection named default-service-connection.
      • Installs Docker Buildx in the worker environment using the Docker Setup Buildx GitHub Action.
      • Authenticates with Container Registry using the Docker Login GitHub Action and the Yandex Cloud IAM token.
      • Builds a Docker image from the Dockerfile located at the repository root and pushes it to Container Registry using the Build and Push Docker images GitHub Action.
      • Deploys a container in Serverless Containers from the built Docker image.
    • Dockerfile, index.html, and docker/nginx/conf.d/default.conf with the configuration of a container with a static web app based on Nginx.
  6. Click Create repository.

Create a service connectionCreate a service connection

SourceCraft UI
  1. Open the SourceCraft home page.

  2. Navigate to the Organizations tab.

  3. Select the organization where you created the Yandex Cloud service account.

  4. On the organization page, in the Settings section, go to the Service connections section.

  5. Click New service connection.

  6. Under Basic information, specify the service connection name, default-service-connection.

  7. Under Scope, select the repository you created earlier.

  8. Under Yandex Cloud settings, select:

    • Folder where you previously deployed the cloud infrastructure and assigned a role to the service account.

    • github-action service account.

      Tip

      To re-request the list of clouds, folders, and service accounts from Yandex Cloud, click Synchronize. This can be of use if alongside creating a service connection you also created a folder or service account.

  9. Click Create service connection.

    Wait for the operation to complete. The page that opens will display the service connection details.

    A Yandex Identity and Access Management workload identity federation will be automatically created in Yandex Cloud.

    To view the parameters of the new OIDC provider, click the federation name under Workload identity federation.

Configure CI/CDConfigure CI/CD

SourceCraft UI
  1. Open the SourceCraft home page.

  2. On the Home tab, under Your craftspace, navigate to Repositories.

  3. Select the repository you created earlier.

  4. Select .sourcecraft/ci.yaml.

  5. In the top-right corner, click Edit.

  6. In the YC_DOCKER_REGISTRY_URI parameter, specify the ID of the registry you previously created:

    YC_DOCKER_REGISTRY_URI: cr.yandex/<registry_ID>
    
  7. In the top-right corner, click Commit changes.

  8. Commit:

    1. Enter a message about the changes.
    2. Under Commit branch, select Commit directly to the branch: main.
    3. Under After commit action, select Just commit.
    4. Click Commit changes.

After saving the changes, demo-service-connection-workflow will start.

Test CI/CDTest CI/CD

SourceCraft UI
  1. Open the SourceCraft home page.
  2. On the Home tab, under Your craftspace, navigate to Repositories.
  3. Select the repository you created earlier.
  4. Under Code on the repository page, go to CI/CD.
  5. In the list of automation executions, you will see a new execution. Wait for the status to change to Success.

Make sure the container has been createdMake sure the container has been created

Management console
CLI
API
  1. In the management console, select Serverless Containers.

  2. In the list, you should see demo-serverless-container1; select it.

    Under Revisions, you should now see the container revision with the same timestamp as the CI/CD process execution.

Run this command:

yc serverless container revision list \
  --container-name demo-serverless-container1

Where --container-name is the container name specified in .sourcecraft/ci.yaml.

Result:

+----------------------+----------------------+--------------------------------------------------------+---------------------+
|          ID          |     CONTAINER ID     |                 IMAGE                                  |     CREATED AT      |
+----------------------+----------------------+--------------------------------------------------------+---------------------+
| bba27hejd69a******** | bba83i1mrb5s******** | cr.yandex/yc/serverless/demo-serverless-container1     | 2025-10-04 09:38:14 |
+----------------------+----------------------+--------------------------------------------------------+---------------------+

Use the listRevisions REST API method for the Container resource or the RegistryService/CreateRegistryRequest gRPC API call.

Delete the resources you createdDelete the resources you created

To stop paying for the resources you created:

  1. Delete the container.
  2. Delete the Docker image.
  3. Delete the registry.

See alsoSee also

  • Configuring CI/CD between SourceCraft and Yandex Cloud Functions
  • Configuring a service connection to Yandex Cloud in SourceCraft
  • Integration with GitHub Actions in SourceCraft
  • serverless-functions repository in SourceCraft
  • yc-ci-cd-serverless repository in SourceCraft

Was the article helpful?

Previous
Configuring CI/CD between Cloud Functions and GitHub
Next
Working with an API gateway via WebSocket
© 2025 Direct Cursus Technology L.L.C.