-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.57 KB
/
test-env-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
name: Test Environment - Deploy
on:
pull_request:
types: [ opened, synchronize, reopened ]
branches:
- master
jobs:
deploy-test-env:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: ${{ github.head_ref }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Build client
run: npm run build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_rsa # optional
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- id: git_push
name: Push to Server
run: |
git remote add server [email protected]:repos/qa.git
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git add build -f
git commit -m "Build files"
exec 5>&1
OUTPUT=$(git push --force --set-upstream server HEAD:${GITHUB_REPOSITORY}--${GITHUB_HEAD_REF} 2>&1 | tee /dev/fd/5)
echo "GIT_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" | grep "^remote: github:" | sed s/^remote:\ github:\ /""/g >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: marocchino/sticky-pull-request-comment@v2
if: ${{ env.GIT_OUTPUT }}
with:
header: test-env
append: true
message: |
${{ env.GIT_OUTPUT }}