-
Notifications
You must be signed in to change notification settings - Fork 4
31 lines (28 loc) · 1.08 KB
/
main.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
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
workflow_dispatch:
env:
# Setting an environment variable with the value of a configuration variable
LABEL: ${{
contains(github.event.pull_request.labels.*.name, 'deploy_5173') && 'deploy_5173' ||
(contains(github.event.pull_request.labels.*.name, 'deploy_5174') && 'deploy_5174' || 'none')
}}
jobs:
run_pull:
if: ${{ env.LABEL != 'none' }}
name: run pull
runs-on: ubuntu-latest
steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
echo env.tag_name
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.LXGR_DEPLOY_PRIV }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.LXGR_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.LXGR_USER }}@${{ secrets.LXGR_HOST }} "cd ~/$LABEL && git fetch && git checkout ${{ github.event.pull_request.base.ref }} && git pull && npm i && exit"
- name: cleanup
run: rm -rf ~/.ssh