-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (37 loc) · 1.25 KB
/
deploy.yml
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
# Uncomment this deploy job in this file to use the
# https://github.com/roots/setup-trellis-cli GitHub Action
# for deploying this repo to production when pushing to main.
#
# Make sure you've set up the following secrets in your repo:
# - TRELLIS_DEPLOY_SSH_PRIVATE_KEY
# - TRELLIS_DEPLOY_SSH_KNOWN_HOSTS
# - ANSIBLE_VAULT_PASSWORD
name: Build and Deploy
on:
push:
branches: [ main, develop ]
env:
NODE_VERSION: 18
ENVIRONMENT: ${{ ( github.ref_name == 'main' ) && 'production' || 'staging' }}
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
cache-dependency-path: yarn.lock
- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.TRELLIS_DEPLOY_SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.TRELLIS_DEPLOY_SSH_KNOWN_HOSTS }}
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.TRELLIS_DEPLOY_SSH_PRIVATE_KEY }}
- uses: roots/setup-trellis-cli@main
with:
ansible-vault-password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
- name: Deploy
run: cd trellis & trellis deploy ${{ env.ENVIRONMENT }}