Merge pull request #4198 from urbit/jt/lacd

Add GitHub Action & Workflow for glob + OTA
This commit is contained in:
Jared Tobin 2021-01-06 00:17:22 +04:00 committed by GitHub
commit af03292f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 0 deletions

4
.github/actions/glob/Dockerfile vendored Normal file
View File

@ -0,0 +1,4 @@
FROM jaredtobin/janeway:v0.13.2
COPY entrypoint.sh /entrypoint.sh
EXPOSE 22/tcp
ENTRYPOINT ["/entrypoint.sh"]

25
.github/actions/glob/action.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: 'glob'
description: 'Create a glob and deploy it to a moon'
inputs:
ship:
description: "Ship to deploy to"
required: true
credentials:
description: "base64-encoded GCP Service Account credentials"
required: true
ssh-sec-key:
description: "A base64-encoded SSH secret key for the container to use"
required: true
ssh-pub-key:
description: "The corresponding base64-encoded SSH public key"
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.ship }}
- ${{ inputs.credentials }}
- ${{ inputs.ssh-sec-key }}
- ${{ inputs.ssh-pub-key }}

32
.github/actions/glob/entrypoint.sh vendored Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
cd "$GITHUB_WORKSPACE" || exit
echo "$2" | base64 -d > service-account
echo "$3" | base64 -d > id_ssh
echo "$4" | base64 -d > id_ssh.pub
chmod 600 service-account
chmod 600 id_ssh
chmod 600 id_ssh.pub
janeway release glob --dev --no-pill \
--credentials service-account \
--ssh-key id_ssh \
--do-it-live \
| bash
SHORTHASH=$(git rev-parse --short HEAD)
janeway release prepare-ota arvo-glob-"$SHORTHASH" "$1" \
--credentials service-account \
--ssh-key id_ssh \
--do-it-live \
| bash
janeway release perform-ota "$1" \
--credentials service-account \
--ssh-key id_ssh \
--do-it-live \
| bash

23
.github/workflows/glob.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: glob
on:
push:
branches:
- 'release/next-js'
pull_request:
branches:
- 'release/next-js'
jobs:
glob:
runs-on: ubuntu-latest
name: "Create and deploy a glob to ~lomlyx-lopsem-nidsut-tomdun"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: ./.github/actions/glob
with:
ship: 'lomlyx-lopsem-nidsut-tomdun'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}