Merge pull request #130 from vim/feature/contributors-guide #69
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 Docker Images | |
on: | |
push: | |
branches: | |
- main | |
- development | |
workflow_run: | |
workflows: | |
- Build and Push Web Docker Image | |
- Build and Push CMS Docker Image | |
branches: | |
- development | |
types: | |
- completed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: setup environment file | |
run: | | |
test -f .env || cp .env.example .env | |
- name: copy files to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "./compose.prod.yml,./.env" | |
target: "~/${{ github.event.repository.name }}/" | |
- name: pull & start container images | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script_stop: true | |
script: | | |
cd ~/${{ github.event.repository.name }}/ | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{github.actor}} --password-stdin | |
docker compose -f compose.prod.yml pull | |
docker compose -f compose.prod.yml down | |
docker compose -f compose.prod.yml up -d --wait --no-build --force-recreate | |
docker compose -f compose.prod.yml logs -t -n 50 |