Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 44 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@
name: Release
name: CI

on:
push:
tags:
- 'v*'
pull_request:
branches:
- main

env:
GO_VERSION: 1.22
GORELEASER_VERSION: v1.25.1

jobs:
release:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Check out source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
fetch-depth: 0
version: latest

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Login to DockerHub
uses: docker/login-action@v3
go-version: ${{ env.GO_VERSION }}
- name: Cache Go modules
uses: actions/cache@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Run goreleaser
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: v1.25.1
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
version: ${{ env.GORELEASER_VERSION }}
install-only: true
- name: Build
run: goreleaser build --clean --snapshot
- name: Run tests
run: go test -v ./...

release:
needs: [build, lint]
uses: ./.github/workflows/release.yml
if: startsWith(github.ref, 'refs/tags/v')
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release

on:
workflow_call:

env:
GO_VERSION: 1.22
GORELEASER_VERSION: v1.25.1

jobs:
release:
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: ${{ env.GORELEASER_VERSION }}
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/c2h5oh/datasize"
"github.com/palantir/go-baseapp/baseapp"
"github.com/palantir/go-baseapp/baseapp/datadog"
"github.com/palantir/go-baseapp/appmetrics/emitter/datadog"
"github.com/palantir/go-githubapp/githubapp"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/die-net/lrucache"
"github.com/gregjones/httpcache"
"github.com/palantir/go-baseapp/baseapp"
"github.com/palantir/go-baseapp/baseapp/datadog"
"github.com/palantir/go-baseapp/appmetrics/emitter/datadog"
"github.com/palantir/go-githubapp/githubapp"
"github.com/palantir/policy-bot/pull"
"github.com/pkg/errors"
Expand Down