-
Notifications
You must be signed in to change notification settings - Fork 44
35 lines (34 loc) · 1.15 KB
/
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
on:
workflow_dispatch
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
- name: bump pzprjs input in puzzlink flake
env:
CONFIG_PUSH_KEY: ${{ secrets.CONFIG_PUSH_KEY }}
BRANCH: main
INPUT: pzprjs
run: |
eval $(ssh-agent -s)
ssh-add - <<< "$CONFIG_PUSH_KEY"
git config --global user.name "deploy bot"
git clone [email protected]:robx/puzzlink-config.git
cd puzzlink-config
git checkout $BRANCH
nix flake lock --override-input "$INPUT" github:robx/pzprjs/"$GITHUB_SHA" --commit-lock-file
echo "CONFIG_REV=$(git rev-parse HEAD)" >> $GITHUB_ENV
git push origin $BRANCH
- name: deploy
env:
NIXY_DEPLOY_KEY: ${{ secrets.NIXY_DEPLOY_KEY }}
NIXY_HOST: "116.202.108.63"
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
run: |
eval $(ssh-agent -s)
ssh-add - <<< "$NIXY_DEPLOY_KEY"
mkdir -p ~/.ssh
echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
ssh -p 2323 deploy@"$NIXY_HOST" sudo deploy ${{ env.CONFIG_REV }}