on master help sign in
ops: full deploy
b12e3f3Hunter Miller
.github/helpers/deploy.shnew file+40
@@ -0,0 +1,40 @@
1+#!/usr/bin/env bash
2+
3+# this script deploys a desk to a ship from a github repository
4+# assumes gcloud credentials are loaded and gcloud installed.
5+
6+repo=$1
7+desk=$2
8+ship=$3
9+ref=${4:-master}
10+folder=$ship/$desk
11+
12+set -e
13+set -o pipefail
14+cmdfile=$(mktemp "${TMPDIR:-/tmp/}build.XXXXXXXXX")
15+# mktemp only used for generating a random folder name below
16+cmds='
17+source_repo=$(mktemp --dry-run /tmp/repo.build.XXXXXXXXX)
18+git clone --depth 1 --branch '$ref' git@github.com:'$repo'.git $source_repo
19+urbit_repo=$(mktemp --dry-run /tmp/repo.urbit.XXXXXXXXX)
20+git clone --depth 1 git@github.com:urbit/urbit.git $urbit_repo -b '$URBIT_REPO_TAG' --single-branch
21+cd $source_repo
22+cd /home/urb || return
23+curl -s --data '\''{"source":{"dojo":"+hood/mount %'$desk'"},"sink":{"app":"hood"}}'\'' http://localhost:12321
24+rsync -avL --delete $urbit_repo/pkg/base-dev/ '$folder'
25+rsync -avL $source_repo/desk/ '$folder'
26+curl -s --data '\''{"source":{"dojo":"+hood/commit %'$desk'"},"sink":{"app":"hood"}}'\'' http://localhost:12321
27+rm -rf $source_repo
28+rm -rf $urbit_repo
29+'
30+echo "$cmds" >> "$cmdfile"
31+sshpriv=$(mktemp "${TMPDIR:-/tmp/}ssh.XXXXXXXXX")
32+sshpub=$sshpriv.pub
33+echo "$SSH_PUB_KEY" >> "$sshpub"
34+echo "$SSH_SEC_KEY" >> "$sshpriv"
35+chmod 600 $sshpub
36+chmod 600 $sshpriv
37+
38+ssh kaladin@urbit.hmiller.dev 'bash -s' < "$cmdfile" -i "$sshpriv" -o "StrictHostKeyChecking=no"
39+
40+echo "OTA performed for $desk on $ship"
.github/workflows/deploy.yml+16−22
@@ -58,25 +58,19 @@ jobs:
58 BRANCH=${INPUT:-"master"}
58 BRANCH=${INPUT:-"master"}
59 git pull origin $BRANCH --rebase --autostash
59 git pull origin $BRANCH --rebase --autostash
60 git push
60 git push
61− # deploy:
61+ deploy:
62− # runs-on: ubuntu-latest
62+ runs-on: ubuntu-latest
63− # needs: glob
63+ needs: glob
64− # name: "Deploy sphinx to live"
64+ name: "Deploy sphinx to live"
65− # steps:
65+ steps:
66− # - uses: actions/checkout@v3
66+ - uses: actions/checkout@v3
67− # with:
67+ with:
68− # ref: ${{ github.event.inputs.tag }}
68+ ref: ${{ github.event.inputs.tag }}
69− # - id: 'auth'
70− # uses: 'google-github-actions/auth@v1'
71− # with:
72− # credentials_json: '${{ secrets.JANEWAY_SERVICE_KEY }}'
73− # - name: 'Set up Cloud SDK'
74− # uses: 'google-github-actions/setup-gcloud@v1'
75− # - id: deploy
69+ - id: deploy
76− # name: Deploy
70+ name: Deploy
77− # run:
71+ run:
78− # ./.github/helpers/deploy.sh tloncorp/landscape-apps groups wannec-dozzod-marzod us-west1-b ${{ github.event.inputs.tag }}
72+ ./.github/helpers/deploy.sh arthyn/sphinx sphinx urbit/dister-nocsyx-lassul ${{ github.event.inputs.tag }}
79− # env:
73+ env:
80− # SSH_SEC_KEY: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
74+ SSH_SEC_KEY: ${{ secrets.SSH_SEC_KEY }}
81− # SSH_PUB_KEY: ${{ secrets.JANEWAY_SSH_PUB_KEY }}
75+ SSH_PUB_KEY: ${{ secrets.SSH_PUB_KEY }}
82− # URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }}
76+ URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }}