Production Server manual deploy #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Deploy to Production | |
on: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: 'Release tag to deploy' | |
required: true | |
jobs: | |
prod_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.release_tag }} | |
- name: Get Release Notes | |
run: | | |
echo "Release Tag: ${{ github.event.inputs.release_tag }}" | |
echo "Release Name: $(git tag -l --format='%(contents)' ${{ github.event.inputs.release_tag }})" | |
- name: Install sshpass | |
run: sudo apt-get install -y sshpass | |
- name: ProdServer CD | |
env: | |
SSH_DEVELOPER_PASSWORD: ${{secrets.PROD_SSH_DEVELOPER_PASSWORD}} | |
GITHUB_CLIENT_ID: ${{ secrets.PROD_GITHUB_CLIENT_ID }} | |
GITHUB_CLIENT_SECRETS: ${{ secrets.PROD_GITHUB_CLIENT_SECRETS }} | |
DATABASE_HOST: ${{secrets.PROD_DATABASE_HOST}} | |
DATABASE_PORT: ${{secrets.PROD_DATABASE_PORT}} | |
DATABASE_USER: ${{ secrets.PROD_DATABASE_USER }} | |
DATABASE_PASSWORD: ${{ secrets.PROD_DATABASE_PASSWORD }} | |
DATABASE_NAME: ${{ secrets.PROD_DATABASE_NAME }} | |
JWT_SECRET: ${{ secrets.PROD_JWT_SECRET }} | |
run: | | |
sshpass -p $SSH_DEVELOPER_PASSWORD \ | |
ssh -o "StrictHostKeyChecking=no" [email protected] \ | |
"cd /home/developer/web10-Lesser && git fetch --all && git checkout ${{ github.event.inputs.release_tag }} && \ | |
GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID \ | |
GITHUB_CLIENT_SECRETS=$GITHUB_CLIENT_SECRETS \ | |
DATABASE_HOST=$DATABASE_HOST \ | |
DATABASE_PORT=$DATABASE_PORT \ | |
DATABASE_USER=$DATABASE_USER \ | |
DATABASE_PASSWORD=$DATABASE_PASSWORD \ | |
DATABASE_NAME=$DATABASE_NAME \ | |
JWT_SECRET=$JWT_SECRET \ | |
docker compose -f docker-compose.yml up -d --build" |