Skip to content

How do I set up a GitHub Actions workflow to automatically deploy a Docker application #139087

Answered by ThienNg0
meobietcode asked this question in Actions
Discussion options

You must be logged in to vote

You can use a combination of GitHub Actions features to achieve this:
name: Deploy the app

on:
pull_request:
branches:

  • main
    types: [closed]

jobs:
check-approvals:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.state == 'closed'
steps:

  • name: Check the number of approvers
    uses: pullreminders/github-action-required-approvals@v1.0
    with:
    required_approvals: 2
    env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy:
needs: check-approvals
runs-on: ubuntu-latest
if: ${{ needs.checkout.outputs.approved == 'true' }}

steps:

  • name: Checkout code
    uses: actions/checkout@v3

Steps to build and push your Docker image

...

  • name: Deploy to Kubernetes
    use…

Replies: 1 comment

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
2 participants