Skip to content

Commit

Permalink
Add a script and GH action to produce builds (#24)
Browse files Browse the repository at this point in the history
This adds a shell script to create the .zip files for the checker and
churner lambdas.

It adds a set of github actions:

try-release.yml just runs the build but doesn't do anything with it.
This is runs on PRs and when they're pushed to main.

release.yml runs the build and then uploads the artifacts to Github
whenever a tag is pushed starting with "v" (which is how normal go
release are tagged). I anticipate replacing this with uploading to S3 in
a future PR, as we need them in S3 for lambda to deploy from.
  • Loading branch information
mcpherrinm authored Dec 20, 2023
1 parent edad2ec commit 625ba99
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Run the release flow
# Keep in sync with try-release.yml

name: Run release
on:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21
- run: ./build-release.sh
- name: upload
uses: actions/upload-artifact@v4
with:
path: "build/*.zip"
if-no-files-found: error
19 changes: 19 additions & 0 deletions .github/workflows/try-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Try the release flow to ensure it works
# Keep in sync with release.yml

name: Try release
on:
push:
branches:
- main
pull_request:

jobs:
try-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.21
- run: ./build-release.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
34 changes: 34 additions & 0 deletions build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -euxo pipefail

# Build the pair of zip files to upload to lambda

mkdir -p build
DIR=$(mktemp -d "build/build-$(git rev-parse --short HEAD)-XXXXXX")
echo "Building in $DIR"

# Churner is just a binary
mkdir -p "$DIR/churner"
go build -o "$DIR/churner/bootstrap" lambda/churner/churner.go
# zip
pushd "$DIR/churner"
zip churner.zip bootstrap
popd
cp "$DIR/churner/churner.zip" build/churner.zip


# Checker binary and certs
mkdir -p "$DIR/checker"
go build -o "$DIR/checker/bootstrap" lambda/checker/checker.go

# Include all the issuers
# TODO(#23): Don't bake these into the release
cp checker/testdata/*.pem "$DIR/checker/"

# zip
pushd "$DIR/checker"
zip checker.zip bootstrap ./*.pem
popd
cp "$DIR/checker/checker.zip" build/checker.zip

echo "built: build/churner.zip build/checker.zip"

0 comments on commit 625ba99

Please sign in to comment.