-
Notifications
You must be signed in to change notification settings - Fork 9
44 lines (37 loc) · 1.13 KB
/
deploy.yml
File metadata and controls
44 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# https://maxschmitt.me/posts/github-actions-ssh-key
---
name: Deploy
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment Environment'
required: true
default: 'staging'
type: choice
options:
- staging
- production
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add SSH key
run: |
mkdir -p /home/runner/.ssh
echo "${{ secrets.DOKKU_HOST_KEY }}" >> /home/runner/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" >> /home/runner/.ssh/github_actions
chmod 600 /home/runner/.ssh/github_actions
echo 'Host dokku
Hostname ${{ secrets.DOKKU_HOST_URL }}
IdentityFile /home/runner/.ssh/github_actions
User dokku' >> /home/runner/.ssh/config
- name: Init Git and deploy
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub actions"
git remote add dokku dokku:${{ inputs.environment }}
git push dokku master -f