Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
edw-defang committed Mar 18, 2024
1 parent 58e6cb8 commit 18ba234
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release

on:
push:
tags:
- '*'

jobs:
build_release:
name: build_release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: build
run: make build
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ github.ref_name }}
tag_name: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./acme.zip
asset_name: acme.linux-amd64.zip
asset_content_type: application/zip
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# VERSION is the version we should download and use.
VERSION:=$(shell git describe --match=NeVeRmAtCh --always --dirty)

BINARY_NAME:=acme
BINARY_NAME:=cloudacme
GOFLAGS:=-ldflags "-X main.version=$(VERSION)"

.PHONY: build
build: $(BINARY_NAME) lambda
build: $(BINARY_NAME) $(BINARY_NAME)-lambda.zip

$(BINARY_NAME): test
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $@ $(GOFLAGS) ./cmd/cli

lambda: test
$(BINARY_NAME)-lambda.zip: test
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bootstrap -tags lambda.norpc $(GOFLAGS) ./cmd/lambda
zip acme.zip bootstrap
zip $(BINARY_NAME)-lambda.zip bootstrap

.PHONY: clean
clean:
rm -f $(BINARY_NAME) $(BINARY_NAME)-lambda.zip bootstrap

.PHONY: test
test: $(PROTOS)
Expand Down
2 changes: 2 additions & 0 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"go.uber.org/zap"
)

var version = "dev" // to be set by ldflags

func main() {

var debug *bool = pflag.Bool("debug", false, "Enable debug logging")
Expand Down
4 changes: 4 additions & 0 deletions cmd/lambda/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"go.uber.org/zap"
)

var version = "dev" // to be set by ldflags

type Event struct {
events.ALBTargetGroupRequest
events.EventBridgeEvent
Expand All @@ -28,6 +30,7 @@ type Event struct {
var logger *zap.Logger

func HandleEvent(ctx context.Context, evt Event) (any, error) {
log.Printf("cloudacme version %v", version)
var err error
logger, err = zap.NewDevelopment()
if err != nil {
Expand Down Expand Up @@ -180,6 +183,7 @@ func getAccountKey() (*ecdsa.PrivateKey, error) {

func HandleEventBridgeEvent(ctx context.Context, evt events.EventBridgeEvent) error {
log.Printf("Handling EventBridge Event: %+v", evt)
// TODO: implement certificate renewal
return nil
}

Expand Down

0 comments on commit 18ba234

Please sign in to comment.