This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
74 lines (69 loc) · 1.99 KB
/
test-publish-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# This actions runs against every Tag to Prod (or) next tag(Ex:v0.4.6-next.3) to dev
name: Test, publish & deploy
on:
push:
tags:
- v*
jobs:
# Build & lint & test & publish
Build_Publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
# Run Docker start, node starts
- name: Build project & docker start
run: |
cp sample.config.toml test.config.toml
chmod -R 777 test/docker/config
npm run docker:start
sleep 30
# Run yarn scripts
- name: yarn install & lint & test
run: |
yarn install
yarn lint
yarn test
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > ~/.npmrc
- run: npm publish --access public --tag next
if: contains(github.ref, '-next.')
- run: npm publish --access public
if: contains(github.ref, '-next.') != true
# Dev Deployment
DeployDev:
if: contains(github.ref, '-next.')
name: Deploy to Dev
needs: [Build_Publish]
runs-on: ubuntu-latest
environment:
name: development
steps:
- uses: appleboy/ssh-action@master
env:
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
with:
host: ${{secrets.SSH_NEXT_HOST}}
username: ${{secrets.SSH_USER}}
key: ${{secrets.SSH_KEY}}
port: 22
script: ./update_reload_next
# Prod Deployment
ProdDeploy:
if: contains(github.ref, '-next.') != true
name: Deploy to Production
needs: [Build_Publish]
runs-on: ubuntu-latest
environment:
name: production
steps:
- uses: appleboy/ssh-action@master
env:
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
with:
host: ${{secrets.SSH_NEXT_HOST}}
username: ${{secrets.SSH_USER}}
key: ${{secrets.SSH_KEY}}
port: 22
script: ./update_reload