The deploy-container GitHub Action deploys a container image to Gcore Container as a Service (CaaS). The container status and endpoint address are available as GitHub Action outputs for use in future steps.
Important
A Gcore permanent API token is required to authorize access to the Gcore API.
name: Deploy
on:
workflow_dispatch:
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- id: deploy
uses: gcore-github-actions/deploy-container@v1
with:
api-token: ${{ secrets.GCLOUD_API_TOKEN }}
project-id: ${{ vars.GCLOUD_PROJECT }}
region-id: ${{ vars.GCLOUD_REGION }}
name: my-container
image: nginx:latest
- name: Use output
run: echo "${{ steps.deploy.outputs.address }}"Note
This action runs using Node 20. If you are using self-hosted GitHub Actions runners, you must use a runner version that supports this version or newer.
-
api-token- (required) A permanent API token that will authenticate the GitHub action to Gcore API. -
project-id- (required) The ID of the Gcore project in which the container should be deployed. -
region-id- (required) The ID of the region in which the container should be deployed. -
name- (required) The name of the container to deploy. -
image- (required) The name of the container image to deploy (e.g. docker.io/nginx:latest). -
listening-port- (optional) The port on which the container will be listening for network connections. The default value is80. -
description- (optional) A custom description of the container. -
envs- (optional) List of newline-separated key-value pairs to set as environment variables.with: envs: | FOO=bar BAZ=biz
-
flavor- (optional) The container flavor determining the amount of memory and cpu allocated to each container instance. The default value is80mCPU-128MB. -
timeout- (optional) The duration in seconds to wait before scaling down container instances. The default value is60. -
scale-min- (optional) The minimum number of instances to run. When set to0, the container will scale down to zero running instances when it receives no traffic for the duration oftimeout. The default value is1. -
scale-max- (optional) The maximum number of instances to run. The value must be greater than or equal to scale-min. The default value is1. -
is-disabled- (optional) When set totrue, the container is disabled and any running instances are shut down. The default value isfalse. -
is-api-key-auth- (optional) When set totrue, enables API key authentication for the container endpoint address. API keys can be created and assigned to the container in Gcore dashboard. The default value isfalse. -
pull-secret- (optional) The name of the private registry credentials to use when fetching the container image. The credentials must already be configured in Gcore dashboard.
address: The endpoint address of your container.status: The status of your container (e.g. Pending, Deploying, Ready, Error).status-message: The last message associated with current container status. Can be useful for troubleshooting deployment issues.
- Install act
- Create a
.secretsfile with yourGCLOUD_API_TOKENvalue. - Create a
.varsfile with yourGCLOUD_API_URL,GCLOUD_PROJECTandGCLOUD_REGIONvalues. - Run
npm run localafter any change to test it using thetest-local-actionworkflow.
Note
Remember to call npm run all before committing your changes and pushing them to remote.
- Run the
./script/releasescript to create and push a new tag. - A workflow will run and generate a new draft release for you based on the tag you entered.
- Open the Releases page and go to the draft release.
- Make sure the
Publish this release to the GitHub Marketplacecheckbox is checked and changelog is correct. - Publish the new release.
- Move the major version tag (e.g. v1) to the latest patch release.