From 2f31b4cf13a60bcb2faa13cc7b5d944453c1c176 Mon Sep 17 00:00:00 2001 From: Sylvain Reynaud Date: Mon, 24 Apr 2023 13:13:49 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20add=20release=20ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release-drafter.yml | 43 +++++++++++++++++++++++++++++ .github/workflows/ci.yml | 34 +++++++++++++++++++++++ .github/workflows/label-checker.yml | 33 ++++++++++++++++++++++ .github/workflows/release.yml | 36 ++++++++++++++++++++++++ main.go | 1 - 5 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/label-checker.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..07bf4de --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,43 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +template: | + ## What Changed + $CHANGES + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION +categories: + - title: Features + labels: + - "type: feat" + - title: Fixes + labels: + - "type: fix" + - title: Documentation + labels: + - "type: docs" + - title: CI + labels: + - "type: ci" + - title: Dependency Updates + labels: + - "type: build" + - title: Refactor + labels: + - "type: refactor" + collapse-after: 5 + +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" +change-title-escapes: '\<*_&' +version-resolver: + major: + labels: + - major + minor: + labels: + - minor + patch: + labels: + - patch + default: patch + +exclude-labels: + - skip-changelog diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a9d3be9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: GO CI +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up Go 1.20 + uses: actions/setup-go@v3 + with: + go-version: "1.20" + + - name: Build + run: go build -v -o gateway *.go + + # - name: Test + # run: go test -v ./... + + release-drafter: + needs: build + runs-on: ubuntu-22.04 + steps: + - name: Release Drafter + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/label-checker.yml b/.github/workflows/label-checker.yml new file mode 100644 index 0000000..c6a5868 --- /dev/null +++ b/.github/workflows/label-checker.yml @@ -0,0 +1,33 @@ +name: Label Checker +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + check_semantic_release_label: + name: Check for semantic version label + runs-on: ubuntu-latest + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest + with: + one_of: major,minor,patch,skip-changelog + repo_token: ${{ secrets.GITHUB_TOKEN }} + + check_labels: + name: Check labels + runs-on: ubuntu-latest + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest + with: + any_of: documentation,enhancement,feature,fix,chore + none_of: invalid,wontfix,duplicate,question,bug + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f8c0da6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release +on: + release: + types: + - published + +jobs: + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up Go 1.20 + uses: actions/setup-go@v3 + with: + go-version: "1.20" + + # - name: Test + # run: go test -v ./... + + release: + strategy: + matrix: + goarch: ["amd64", "arm64"] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Build + uses: wangyoucao577/go-release-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: linux + goarch: ${{ matrix.goarch }} + goversion: "1.20" + binary_name: gateway diff --git a/main.go b/main.go index 26f907c..58f4810 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,6 @@ func main() { } log.SetLevel(level) - // Run the registry HTTP server gw, err := gateway.NewServer() if err != nil { log.Fatalf("failed to initialize the gateway: %v", err)