49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
name: Deploying
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Deploy", "Deploy static content to Pages"]
|
|
branches:
|
|
- master
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
deploy_after_master_push:
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Deploy via SSH
|
|
if: github.event.workflow_run.name == 'Deploy'
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
run: |
|
|
mkdir -p ~/.ssh/
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/github
|
|
chmod 600 ~/.ssh/github
|
|
cat >>~/.ssh/config <<END
|
|
Host target
|
|
HostName $SSH_HOST
|
|
User $SSH_USER
|
|
IdentityFile ~/.ssh/github
|
|
LogLevel ERROR
|
|
StrictHostKeyChecking no
|
|
END
|
|
ssh target "cd tldtest && git pull origin master && docker-compose down && docker-compose up --build -d"
|
|
|
|
- name: Deploy static content to GitHub Pages
|
|
if: github.event.workflow_run.name == 'Deploy static content to Pages'
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.workflow_run.head_commit.sha }}
|
|
- name: Deploy static content to Pages
|
|
if: github.event.workflow_run.name == 'Deploy static content to Pages'
|
|
uses: actions/deploy-pages@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|