Skip to content

Commit

Permalink
Added lxgr deployment action
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux authored Nov 29, 2023
1 parent cc23657 commit 518da0c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
workflow_dispatch:
env:
# Setting an environment variable with the value of a configuration variable
tag_name: ${{
contains(github.event.pull_request.labels.*.name, 'deploy_5173') && 'deploy_5173' ||
(contains(github.event.pull_request.labels.*.name, 'deploy_5174') && 'deploy_5175' || "")
}}


jobs:
run_pull:
if: ${{ env.tag_name != "" }}
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 ~/$tag_name && git fetch && git checkout ${{ github.event.pull_request.base.ref }} && git pull && npm i && exit"
- name: cleanup
run: rm -rf ~/.ssh

0 comments on commit 518da0c

Please sign in to comment.