GitHub Action to deploy Docker images via Uncloud. First-party support is the goal!
This is a full flow!
name: Deploy to production
on:
push:
branches:
- main
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0.
- name: Build image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0.
with:
context: .
file: apps/my-app/Dockerfile
tags: my-app:latest
load: true
- name: Deploy via Uncloud
uses: thatskyapplication/uncloud-action@898b95231b74d735a044b9aaea91eb321419b5d9 # v1.2.3.
with:
image-tag: my-app:latest
compose-files: compose.yaml
uncloud-profile: my-app
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
server-user: ${{ secrets.SERVER_USER }}
server-host: ${{ secrets.SERVER_HOST }}
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
API_KEY: ${{ secrets.API_KEY }}To push an image to a server without deploying, set push-only: true.
- name: Push image to server
uses: thatskyapplication/uncloud-action@898b95231b74d735a044b9aaea91eb321419b5d9 # v1.2.3.
with:
image-tag: my-app:latest
push-only: true
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
server-user: ${{ secrets.SERVER_USER }}
server-host: ${{ secrets.SERVER_HOST }}