Skip to content

Commit

Permalink
Add CI & release pipeline (#2)
Browse files Browse the repository at this point in the history
* Add CI

* fixup

* fixup

* fixup

* fixup

* add github token to goreleaser
  • Loading branch information
orishoshan authored Sep 14, 2022
1 parent 86eda59 commit bdfa7ba
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build
concurrency:
group: "${{ github.repository }}${{ github.ref }}"
cancel-in-progress: true

on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'

- name: Build
run: |-
go generate ./...
git config --global url."https://[email protected]/".insteadOf "https://github.com/" && go build ./src/cmd && git config --global --unset url."https://[email protected]/".insteadOf
env:
GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build
concurrency:
group: "${{ github.repository }}${{ github.ref }}-release"

on:
push:
tags:
- 'v*.*.*'

env:
REGISTRY: 353146681200.dkr.ecr.us-east-1.amazonaws.com/otterize
REPOSITORY_NAME: otterize

jobs:
publish-release:
name: Push to Docker Hub
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
# vendor/

# IDE
.idea/
.idea/
dist/
35 changes: 35 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
main:
./src/cmd
binary: otterize
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
2 changes: 1 addition & 1 deletion src/go.mod → go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/otterize/otterize-cli/src
module github.com/otterize/otterize-cli

go 1.18

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pkg/mapperclient/genqlient.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# genqlient config; for full documentation see:
# https://github.com/Khan/genqlient/blob/main/docs/genqlient.yaml
schema:
- ../../../graphql/schema.graphql
- ../../graphql/schema.graphql
operations:
- genqlient.graphql
generated: generated.go
2 changes: 1 addition & 1 deletion src/tools.go → tools.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build tools
// +build tools

package networkmapper
package otterize_cli

import _ "github.com/Khan/genqlient/generate"

0 comments on commit bdfa7ba

Please sign in to comment.