Skip to content

Commit

Permalink
Merge pull request #117 from vadimi/feature/github-actions
Browse files Browse the repository at this point in the history
Feature: GitHub actions
  • Loading branch information
vadimi authored Aug 16, 2024
2 parents c60f2e0 + af513d7 commit d7c0ef5
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: cimg/go:1.22
- image: cimg/go:1.23
environment:
TEST_RESULTS: /tmp/test-results
steps:
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: build

on:
push:
branches:
- main
- "feature/**"
tags:
- v*

jobs:
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.23

- name: test
run: |
export GOTESTSUM_VERSION=1.12.0
curl -L https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_linux_amd64.tar.gz | sudo tar -C /usr/local/bin -xz
gotestsum --format short-verbose --no-summary=skipped ./...
- name: build
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: --skip=publish,validate --clean --snapshot

- name: prepare dist directory
run: |
find ./dist/ -not -name '*.tar.gz' -not -name '*.zip' -not -name 'dist' -not -wholename './dist/grpc-client-cli_linux_amd*' -not -name 'pkg' -delete
- name: store artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist
release:
name: release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: dist

- name: prep
id: prep
run: |
find . -name "grpc-client-cli*" -type f -exec chmod +x {} \;
echo ::set-output name=tags::${GITHUB_REF#refs/tags/v}
- uses: ncipollo/release-action@v1
with:
artifacts: "pkg/grpc-client-cli*"
tag: ${{ github.ref }}
name: ${{ github.ref }}
body: |
v${{ steps.prep.outputs.tags }}
draft: false
prerelease: true
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
builds:
- binary: grpc-client-cli
main: ./cmd/grpc-client-cli
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vadimi/grpc-client-cli

go 1.21.0
go 1.23.0

require (
github.com/AlecAivazis/survey/v2 v2.3.7
Expand Down

0 comments on commit d7c0ef5

Please sign in to comment.