Skip to content

Create docker image deploy action #1

Create docker image deploy action

Create docker image deploy action #1

Workflow file for this run

name: Build, Push and Deploy a Docker Image
on:
push:
branches: [main]
jobs:
build-push-deploy-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6.5.0
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
- name: Deploy the app
uses: digitalocean/app_action/deploy@v2
env:
SAMPLE_DIGEST: ${{ steps.push.outputs.digest }}
with:
token: ${{ secrets.YOUR_DIGITALOCEAN_ACCESS_TOKEN_VARIABLE_NAME }}