Skip to content

releasef trigger redeployment #573

releasef trigger redeployment

releasef trigger redeployment #573

name: Release backend
on:
push:
branches:
- main
jobs:
release:
if: "contains(github.event.head_commit.message, 'releaseb')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:10}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: sammers/wow-pla:latest
- name: Deploy app to production
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.APP_HOST }}
username: ${{ secrets.SSH_HOST_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
docker pull sammers/wow-pla:latest
docker stop wow-pla
docker rm -f wow-pla
docker run --restart=always -e CLIENT_ID="${{ secrets.CLIENT_ID }}" -e CLIENT_SECRET="${{ secrets.CLIENT_SECRET }}" -e DB_URI="${{ secrets.DB_URI }}" --name wow-pla -d -p9000:9000 sammers/wow-pla:latest