Devnet #473
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
types: [opened, labeled, unlabeled, synchronize] | |
workflow_dispatch: | |
jobs: | |
run_pull: | |
name: run pull | |
runs-on: ubuntu-latest | |
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') | |
}} | |
steps: | |
- name: exit | |
if: ${{ env.LABEL == 'none' }} | |
run: | | |
exit 1 | |
- 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.head.ref }} && git pull && npm i && npm run build && exit" | |
- name: cleanup | |
run: rm -rf ~/.ssh |