-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: 'glob' | ||
description: 'Create a glob and push to develop' | ||
inputs: | ||
folder: | ||
description: "Folder to glob" | ||
required: true | ||
docket: | ||
description: "Docket file to edit" | ||
required: true | ||
access_key: | ||
description: "S3 access key" | ||
required: true | ||
secret_key: | ||
description: "S3 secret key" | ||
required: true | ||
outputs: | ||
hash: | ||
description: "Glob hash" | ||
value: ${{ steps.glob.outputs.hash }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up S3cmd cli tool | ||
uses: s3-actions/[email protected] | ||
with: | ||
provider: digitalocean | ||
region: nyc3 | ||
access_key: ${{ inputs.access_key }} | ||
secret_key: ${{ inputs.secret_key }} | ||
- id: glob | ||
shell: bash | ||
run: | ||
./.github/helpers/glob.sh "${{ inputs.folder }}" ${{ inputs.docket }} | ||
- name: Upload Glob and Cleanup | ||
shell: bash | ||
run: | | ||
ls -al /home/runner | ||
s3cmd put zod/.urb/put/*.glob -P s3://hmillerdev/silo/ | ||
sleep 5s | ||
rm -rf zod |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this script deploys a desk to a ship from a github repository | ||
# assumes gcloud credentials are loaded and gcloud installed. | ||
|
||
repo=$1 | ||
desk=$2 | ||
ship=$3 | ||
ref=${4:-main} | ||
folder=$ship/$desk | ||
|
||
set -e | ||
set -o pipefail | ||
cmdfile=$(mktemp "${TMPDIR:-/tmp/}build.XXXXXXXXX") | ||
# mktemp only used for generating a random folder name below | ||
cmds=' | ||
source_repo=$(mktemp --dry-run /tmp/repo.build.XXXXXXXXX) | ||
git clone --depth 1 --branch '$ref' [email protected]:'$repo'.git $source_repo | ||
urbit_repo=$(mktemp --dry-run /tmp/repo.urbit.XXXXXXXXX) | ||
git clone --depth 1 [email protected]:urbit/urbit.git $urbit_repo -b '$URBIT_REPO_TAG' --single-branch | ||
landscape_repo=$(mktemp --dry-run /tmp/repo.landscape.XXXXXXXXX) | ||
git clone --depth 1 --branch master [email protected]:tloncorp/landscape.git $landscape_repo | ||
cd /home/kaladin | ||
rsync -avL --delete $urbit_repo/pkg/base-dev/ '$folder' | ||
rsync -avL $landscape_repo/desk-dev/ '$folder' | ||
rsync -avL $source_repo/desk/ '$folder' | ||
curl -s --data '\''{"source":{"dojo":"+hood/commit %'$desk'"},"sink":{"app":"hood"}}'\'' http://localhost:12321 | ||
rm -rf $source_repo | ||
rm -rf $urbit_repo | ||
rm -rf $landscape_repo | ||
' | ||
echo "$cmds" >> "$cmdfile" | ||
sshpriv=$(mktemp "${TMPDIR:-/tmp/}ssh.XXXXXXXXX") | ||
sshpub=$sshpriv.pub | ||
echo "$SSH_PUB_KEY" >> "$sshpub" | ||
echo "$SSH_SEC_KEY" >> "$sshpriv" | ||
chmod 600 $sshpub | ||
chmod 600 $sshpriv | ||
|
||
ssh -o StrictHostKeyChecking=no -o LogLevel=quiet -o UserKnownHostsFile=/dev/null -i "$sshpriv" [email protected] 'bash -s' < "$cmdfile" | ||
|
||
echo "OTA performed for $desk on $ship" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this script globs a folder of files, then subsequently uploads the | ||
# glob to bootstrap.urbit.org and replaces the hash in the docket file. | ||
# assumes gcloud credentials are loaded and gsutil installed. | ||
|
||
# $1: the folder of files to glob | ||
# $2: the location of the docket file | ||
|
||
# globber is a prebooted and docked fakezod | ||
curl https://bootstrap.urbit.org/globberv3.tgz | tar xzk | ||
./zod/.run -d | ||
|
||
dojo () { | ||
curl -s --data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' http://localhost:12321 | ||
} | ||
|
||
hood () { | ||
curl -s --data '{"source":{"dojo":"+hood/'"$1"'"},"sink":{"app":"hood"}}' http://localhost:12321 | ||
} | ||
|
||
rsync -avL $1 zod/work/glob | ||
hood "commit %work" | ||
dojo "-garden!make-glob %work /glob" | ||
|
||
hash=$(ls -1 -c zod/.urb/put | head -1 | sed "s/glob-\([a-z0-9\.]*\).glob/\1/") | ||
sed -i "s/glob\-[a-z0-9\.]*glob' *[a-z0-9\.]*\]/glob-$hash.glob' $hash]/g" $2 | ||
|
||
echo "hash=$(echo $hash)" >> $GITHUB_OUTPUT | ||
|
||
hood "exit" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deploy Silo | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
type: string | ||
required: false | ||
default: main | ||
description: Enter the tag to deploy | ||
push: | ||
branches: | ||
- 'main' | ||
jobs: | ||
build-frontend: | ||
runs-on: ubuntu-latest | ||
name: 'Build Frontend' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.tag }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ./ui/.nvmrc | ||
- working-directory: ./ui | ||
run: | | ||
npm ci | ||
npm run build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: 'ui-dist' | ||
path: ui/dist | ||
glob: | ||
runs-on: ubuntu-latest | ||
name: 'Make a glob' | ||
needs: build-frontend | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.tag }} | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: 'ui-dist' | ||
path: ui/dist | ||
- name: 'glob' | ||
uses: ./.github/actions/glob | ||
with: | ||
folder: 'ui/dist/*' | ||
docket: 'desk/desk.docket-0' | ||
access_key: ${{ secrets.S3_ACCESS_KEY }} | ||
secret_key: ${{ secrets.S3_SECRET_KEY }} | ||
- name: Commit and Push Glob | ||
run: | | ||
git config --global user.name github-actions | ||
git config --global user.email [email protected] | ||
git add desk/desk.docket-0 | ||
git commit -n -m "update glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit" | ||
INPUT=${{ github.event.inputs.tag }} | ||
BRANCH=${INPUT:-"master"} | ||
git pull origin $BRANCH --rebase --autostash | ||
git push | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: glob | ||
name: "Deploy silo to live" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.tag }} | ||
- id: deploy | ||
name: Deploy | ||
run: | ||
./.github/helpers/deploy.sh arthyn/silo silo urbit/dister-nocsyx-lassul ${{ github.event.inputs.tag }} | ||
env: | ||
SSH_SEC_KEY: ${{ secrets.SSH_SEC_KEY }} | ||
SSH_PUB_KEY: ${{ secrets.SSH_PUB_KEY }} | ||
URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }} |