Skip to content

Commit

Permalink
add prod auto-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
mateow99 committed Apr 24, 2024
1 parent 2c3cead commit 47ec0df
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Build & Push and Deploy to transit-prod

on:
push:
branches: [release]

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Remote SSH and Deploy
uses: appleboy/ssh-action@master
env:
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
with:
host: ${{ secrets.TRANSIT_PROD_SERVER_HOST }}
username: ${{ secrets.TRANSIT_PROD_SERVER_USERNAME }}
key: ${{ secrets.TRANSIT_PROD_SERVER_KEY }}
envs: IMAGE_TAG
script: |
docker service update --image cornellappdev/transit-python:${IMAGE_TAG} the-stack_python-app

0 comments on commit 47ec0df

Please sign in to comment.