removed sed command from ga workflow #4
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: Deploy to Server | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- closed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Make envfile | |
id: envfile | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_COMPOSE_PROJECT_NAME: ${{ secrets.COMPOSE_PROJECT_NAME }} | |
envkey_CN: ${{ secrets.CN }} | |
envkey_DIN: ${{ secrets.DIN }} | |
envkey_DIV: ${{ secrets.DIV }} | |
envkey_DLU: ${{ secrets.DLU }} | |
envkey_DLP: ${{ secrets.DLP }} | |
envkey_DCF: ${{ secrets.DCF }} | |
envkey_ED: ${{ secrets.ED }} | |
envkey_EP: ${{ secrets.EP }} | |
envkey_EF: ${{ secrets.EF }} | |
envkey_REPO: ${{ secrets.REPO }} | |
directory: ops | |
file_name: .env.prod | |
fail_on_empty: false | |
sort_keys: false | |
- name: Build and push Docker image | |
env: | |
DLU: ${{ secrets.DLU }} | |
DLP: ${{ secrets.DLP }} | |
DIN: ${{ secrets.DIN}} | |
DIV: ${{ secrets.DIV}} | |
run: | | |
docker build -t $DIN:$DIV . | |
echo $DLP | docker login -u $DLU --password-stdin | |
docker push $DIN:$DIV | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: SSH into the server and run the app | |
run: | | |
# Copy .env.prod to the deploy server | |
scp -o "StrictHostKeyChecking=no" -r ops/.env.prod [email protected]:/var/docker/dclm-dtc/ops | |
# Deploy new app | |
ssh -o "StrictHostKeyChecking=no" [email protected] "cd /var/docker/dclm-dtc && make new && make down && make up" |