Skip to content

Commit

Permalink
Merge pull request #103 from silinternational/develop
Browse files Browse the repository at this point in the history
Release 6.8.0 -- use GoReleaser to build and publish a Lambda binary
  • Loading branch information
briskt authored Apr 9, 2024
2 parents 14ceae9 + e8aec7f commit 632b203
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Test
name: CI

on:
push:
branches:
- "**"
tags-ignore:
- "*"

jobs:
test:
Expand All @@ -15,10 +13,26 @@ jobs:
go-version: [ '1.20', '1.21', '1.22' ]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- run: go test -v ./...
- run: go test -v ./...

publish:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Fetch all tags
run: git fetch --force --tags

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This is the configuration for goreleaser
# Check the documentation at http://goreleaser.com for details
before:
hooks:
- go mod tidy
builds:
- main: ./cmd/lambda
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
flags:
- -tags=lambda.norpc
gomod:
proxy: true
4 changes: 2 additions & 2 deletions cmd/syncpeeps.go → cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package main
import (
"os"

personnel_sync "github.com/silinternational/personnel-sync/v6"
sync "github.com/silinternational/personnel-sync/v6"
)

func main() {
configFile := ""
if len(os.Args) > 1 {
configFile = os.Args[1]
}
if err := personnel_sync.RunSync(configFile); err != nil {
if err := sync.RunSync(configFile); err != nil {
os.Exit(1)
}
os.Exit(0)
Expand Down
19 changes: 19 additions & 0 deletions cmd/lambda/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"github.com/aws/aws-lambda-go/lambda"

sync "github.com/silinternational/personnel-sync/v6"
)

type LambdaConfig struct {
ConfigPath string
}

func main() {
lambda.Start(handler)
}

func handler(lambdaConfig LambdaConfig) error {
return sync.RunSync(lambdaConfig.ConfigPath)
}

0 comments on commit 632b203

Please sign in to comment.