-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (62 loc) · 2.51 KB
/
Copy pathtest-branch-cd.yml
File metadata and controls
67 lines (62 loc) · 2.51 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: build and delopy test environment
on:
push:
branches: [ test ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache-dependencies
uses: actions/cache@v2.1.4
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install project dependencies
run: yarn --prefer-offline
- name: Build project
run: yarn build
env:
CI: "false"
#
# deploy
- name: remove app
uses: appleboy/ssh-action@1a8b3784eaa665f677fa114edd5683bb6a6bfaa8
with:
host: ${{ secrets.TEST_REMOTE_HOST }}
username: ${{ secrets.TEST_REMOTE_USER }}
key: ${{ secrets.TEST_SERVER_SSH_KEY }}
script: rm -rf ${{ secrets.TEST_REMOTE_APP_TARGET }}
- name: upload app
# You may pin to the exact commit or the version.
uses: easingthemes/ssh-deploy@191986574c0735ffad7ae1a297a414d6e6f95375
# uses: easingthemes/ssh-deploy@v2.1.5
with:
# Private Key
SSH_PRIVATE_KEY: ${{ secrets.TEST_SERVER_SSH_KEY }}
# Remote host
REMOTE_HOST: ${{ secrets.TEST_REMOTE_HOST }}
# Remote user
REMOTE_USER: ${{ secrets.TEST_REMOTE_USER }}
# Source directory
SOURCE: public/
# Target directory, example /home/**/web/
TARGET: ${{ secrets.TEST_REMOTE_APP_TARGET }}
# Invalidate app in Cloudfront
- name: Invalidate panel in cloudfront
uses: chetan/invalidate-cloudfront-action@819473e1ccf40ea3178b75c8f31ae375fb45d388
env:
DISTRIBUTION: ${{ secrets.TEST_APP_CF_ID }}
PATHS: '/*'
AWS_REGION: 'ap-northeast-1'
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_CF_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_CF_SECRET_ACCESS_KEY }}