-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (42 loc) · 2.25 KB
/
main.yaml
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
45
46
47
48
49
50
# The setup is made mostly hard by my idea of creating a dedicated "continuous integration" ssh key. I normally use one ssh
# key for everything, but i don't feel like putting the private key on the interwebz :
# - have "mup deploy" running correctly from your machine first (learn more http://meteor-up.com/getting-started.html) with your regular ssh key
# - create a new key pair for CI deploys, lets call it id_rsa_do, by running ssh-keygen (learn more https://is.gd/kJkcAP)
# - add the content of (~/.ssh/id_rsa_do) in your repository as the secret "SSH_KEY" (learn more about the ssh-key-action https://is.gd/Ux9OXY)
# - add the output of "ssh-keyscan -H [IP OF YOUR DO SERVER]" in your repository as the secret "KNOWN_HOSTS" (learn more https://is.gd/edNByI)
# - make sure your droplet accepts the new key pair, run cat ~/.ssh/id_rsa_do.pub | ssh root@[IP OF YOUR DO SERVER] "cat >> ~/.ssh/authorized_keys" ( learn more https://is.gd/Ufjpvq)
# - to make builds faster, list dev only dependencies as devDependencies in package.json ( learn more https://is.gd/0spDMp )
# - add this file to your app, in the same folder as here (.github/workflows/main.yml)
# - change the last command of this script so that it finds your mup.js file
name: Deploy meteor app to server
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
environment: prod
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
# Test SSH connectivity (fail fast)
- name: Test ssh key to fail fast
run: ssh ${{ vars.SSH_USER }}@${{ vars.SSH_HOST }} -t "pwd"
- uses: actions/checkout@v2
- name: Get production dependencies only
run: cd ./app && npm install --production
- name: Install mup locally
run: npm install mup
- name: Install meteor
run: curl https://install.meteor.com/?release=2.1 | sh
- name: Bundle the app and upload to Hoster
run: cd ./deploy && npx mup deploy
env:
SSH_USER: ${{ vars.SSH_USER }}
SSH_HOST: ${{ vars.SSH_HOST }}
DOMAIN: ${{ vars.DOMAIN }}
PROXY_PORT: ${{ vars.PROXY_PORT }}