forked from kgateway-dev/kgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: timflannagan <timflannagan@gmail.com>
- Loading branch information
1 parent
99db769
commit eb72c2b
Showing
6 changed files
with
203 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Label PR by Kind | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, reopened, synchronize] | ||
|
||
permissions: | ||
issues: write | ||
|
||
jobs: | ||
kind-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# - name: Check out code | ||
# uses: actions/checkout@v2 | ||
- name: Dump out PR description | ||
run: | | ||
sudo apt-get install jq | ||
PR_DESCRIPTION=$(jq -r ".pull_request.body" "$GITHUB_EVENT_PATH") | ||
echo "PR_DESCRIPTION: $PR_DESCRIPTION" | ||
# - name: enhancement | ||
# if: contains(github.event.pull_request.description, '/kind enhancement') | ||
# uses: christianvuerings/add-labels@v1 | ||
# with: | ||
# labels: | | ||
# kind/enhancement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
name: goreleaser | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
|
||
# TODO(tim): Manage tools in this repo better so we can cache them. | ||
# - uses: actions/cache@v4 | ||
# with: | ||
# path: hack/tools | ||
# key: ${{ runner.os }}-go-tools${{ hashFiles('hack/tools/go.sum') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-go-tools- | ||
|
||
- name: Log into ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set the release related variables | ||
id: set_vars | ||
run: | | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
# Release tags. | ||
VERSION="${GITHUB_REF#refs/tags/}" | ||
echo GORELEASER_ARGS="--clean" | ||
elif [[ $GITHUB_REF == refs/heads/main ]]; then | ||
# 'main' branch build. | ||
VERSION="$(echo "${GITHUB_REF#refs/heads/}" | sed -r 's|/+|-|g')" | ||
echo GORELEASER_ARGS="--clean --skip=validate" >> $GITHUB_ENV | ||
elif [[ $GITHUB_REF == refs/pull/* ]]; then | ||
# PR build. | ||
VERSION="pr-$(echo "${GITHUB_REF}" | sed -E 's|refs/pull/([^/]+)/?.*|\1|')" | ||
else | ||
VERSION="$(git describe --tags --always)" | ||
fi | ||
echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
- name: Run goreleaser | ||
run: make release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ env.VERSION }} | ||
IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,5 @@ istio-*/* | |
|
||
# Bin directory created by e2e test | ||
.bin/ | ||
# Added by goreleaser init: | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version: 2 | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go mod download | ||
builds: | ||
- id: controller | ||
main: ./projects/gloo/cmd/ | ||
binary: gloo-linux-{{ .Arch }} | ||
gcflags: "{{ .Env.GCFLAGS }}" | ||
ldflags: "{{ .Env.LDFLAGS }}" | ||
env: | ||
- CGO_ENABLED=0 | ||
- GO111MODULE=on | ||
- GOARCH={{ .Arch }} | ||
- GOOS={{ .Os }} | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
dockers: | ||
- image_templates: | ||
- &arm_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_REPO }}:{{ .Env.VERSION }}-arm64" | ||
use: buildx | ||
dockerfile: &dockerfile projects/gloo/cmd/Dockerfile | ||
goos: linux | ||
goarch: arm64 | ||
build_flag_templates: | ||
- "--pull" | ||
- "--platform=linux/arm64" | ||
- "--build-arg=GOARCH=arm64" | ||
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_GLOO_IMAGE }}" | ||
- image_templates: | ||
- &amd_image "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_REPO }}:{{ .Env.VERSION }}-amd64" | ||
use: buildx | ||
dockerfile: *dockerfile | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- "--pull" | ||
- "--platform=linux/amd64" | ||
- "--build-arg=GOARCH=amd64" | ||
- "--build-arg=ENVOY_IMAGE={{ .Env.ENVOY_GLOO_IMAGE }}" | ||
docker_manifests: | ||
- name_template: "{{ .Env.IMAGE_REGISTRY }}/{{ .Env.IMAGE_REPO }}:{{ .Env.VERSION }}" | ||
image_templates: | ||
- *amd_image | ||
- *arm_image | ||
changelog: | ||
use: "github-native" | ||
sort: "asc" | ||
disable: false | ||
release: | ||
draft: false | ||
prerelease: "auto" | ||
mode: "replace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package changelog | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/go-git/go-git/v5" | ||
) | ||
|
||
func main() { | ||
if err := generate(); err != nil { | ||
fmt.Fprintf(os.Stderr, err.Error()) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func generate() error { | ||
r, err := git.PlainOpen(".") | ||
if err != nil { | ||
return err | ||
} | ||
} |