Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions CI and release improvements #89

Merged
Merged
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
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

name: ci
name: test
on:
push:
pull_request:
jobs:
goreleaser:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version-file: go.mod

Expand All @@ -22,8 +22,3 @@ jobs:

- name: Lint
run: make lint

- name: Run GoReleaser
run: make release
env:
RELEASE_ARGS: release --rm-dist --snapshot
24 changes: 18 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
name: release
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'

jobs:
goreleaser:
release:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Set the release related variables
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo RELEASE_ARGS="--clean" >> $GITHUB_ENV
echo ENABLE_RELEASE_PIPELINE=true >> $GITHUB_ENV

- name: Run GoReleaser
run: make release
env:
RELEASE_ARGS: release --rm-dist
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

- name: Update new version in krew-index
uses: rajatjindal/krew-release-bot@v0.0.38
if: startsWith(github.ref, 'refs/tags/v')
uses: rajatjindal/krew-release-bot@v0.0.46
3 changes: 3 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ archives:
format: tar.gz
files:
- LICENSE

release:
disable: '{{ ne .Env.ENABLE_RELEASE_PIPELINE "true" }}'
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ lint:
source ./scripts/fetch.sh; fetch golangci-lint 1.50.1 && ./bin/golangci-lint --timeout 3m run

.PHONY: release
RELEASE_ARGS?=release --rm-dist --snapshot
RELEASE_ARGS?=release --clean --snapshot
release:
source ./scripts/fetch.sh; fetch goreleaser 1.13.0 && ./bin/goreleaser $(RELEASE_ARGS)
source ./scripts/fetch.sh; fetch goreleaser 1.22.1 && ./bin/goreleaser $(RELEASE_ARGS)
1 change: 1 addition & 0 deletions scripts/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ROOT="$( git rev-parse --show-toplevel )"

fetch() {
mkdir -p "${ROOT}/bin"
local tool=$1; shift
local ver=$1; shift

Expand Down
Loading