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

update release related stuffs #18

Merged
merged 4 commits into from
Jan 2, 2023
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
22 changes: 22 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: release
description: release ghg
inputs:
tag:
description: tag name to be released
default: ''
token:
description: GitHub token
required: true
runs:
using: composite
steps:
- name: setup go
uses: actions/setup-go@v3
with:
go-version: 1.x
- name: release
run: |
make crossbuild upload
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
14 changes: 14 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- uses: ./.github/actions/release
with:
token: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/reviewdog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: reviewdog
on: [pull_request]

jobs:
staticcheck:
name: staticcheck
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
persist-credentials: false
- name: staticcheck
uses: reviewdog/action-staticcheck@v1
with:
reporter: github-pr-review
level: warning

misspell:
name: misspell
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
persist-credentials: false
- name: misspell
uses: reviewdog/action-misspell@v1
with:
reporter: github-pr-review
level: warning
locale: "US"

actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-review
25 changes: 25 additions & 0 deletions .github/workflows/tagpr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: tagpr
on:
push:
branches:
- "main"
jobs:
tagpr:
runs-on: ubuntu-latest
steps:
- name: setup go
uses: actions/setup-go@v3
with:
go-version: 1.x
- name: checkout
uses: actions/checkout@v3
- name: tagpr
id: tagpr
uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/release
with:
tag: ${{ steps.tagpr.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
if: "steps.tagpr.outputs.tag != ''"
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test
on:
push:
branches:
- "**"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: test
run: go test -coverprofile coverage.out -covermode atomic ./...
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Send coverage
uses: codecov/codecov-action@v1
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.*
!.gitignore
!.travis.yml
!.goxc.json
!.github
dist/
vendor/
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

63 changes: 29 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
VERSION = $(shell gobump show -r)
VERSION = $(shell godzil show-version)
CURRENT_REVISION = $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS = "-X github.com/Songmu/ghg.revision=$(CURRENT_REVISION)"
BUILD_LDFLAGS = "-s -w -X github.com/Songmu/ghg.revision=$(CURRENT_REVISION)"
ifdef update
u=-u
endif

GO ?= GO111MODULE=on go

.PHONY: deps
deps:
env GO111MODULE=on go mod download

devel-deps: deps
$(GO) get ${u} \
golang.org/x/lint/golint \
github.com/mattn/goveralls \
github.com/motemen/gobump/cmd/gobump \
github.com/Songmu/goxz/cmd/goxz \
github.com/Songmu/ghch/cmd/ghch \
github.com/tcnksm/ghr

test: deps
$(GO) test
go get ${u} -d
go mod tidy

lint: devel-deps
$(GO) vet
golint -set_exit_status
.PHONY: devel-deps
devel-deps:
go install github.com/tcnksm/ghr@latest
go install github.com/Songmu/godzil/cmd/godzil@latest

cover: devel-deps
goveralls
.PHONY: test
test:
go test

.PHONY: build
build: deps
$(GO) build -ldflags=$(BUILD_LDFLAGS) ./cmd/ghg
go build -ldflags=$(BUILD_LDFLAGS) ./cmd/ghg

crossbuild: devel-deps
env GO111MODULE=on goxz -pv=v$(shell gobump show -r) -build-ldflags=$(BUILD_LDFLAGS) \
-os=linux,darwin,windows,freebsd -arch=amd64 -d=./dist/v$(shell gobump show -r) \
./cmd/ghg
.PHONY: install
install:
go install -ldflags=$(BUILD_LDFLAGS) ./cmd/ghg

bump: devel-deps
_tools/releng
CREDITS: go.sum devel-deps
godzil credits -w

upload:
ghr v$(VERSION) dist/v$(VERSION)

release: bump crossbuild upload
DIST_DIR = dist
.PHONY: crossbuild
crossbuild: go.sum devel-deps
rm -rf $(DIST_DIR)
godzil crossbuild -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) \
-os=linux,darwin,windows,freebsd -d=$(DIST_DIR) ./cmd/*
cd $(DIST_DIR) && shasum -a 256 $$(find * -type f -maxdepth 0) > SHA256SUMS

.PHONY: deps devel-deps test lint cover build crossbuild build upload release
.PHONY: upload
upload:
ghr v$(VERSION) $(DIST_DIR)
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
ghg
=======

[![Build Status](https://travis-ci.org/Songmu/ghg.png?branch=master)][travis]
[![Build Status](https://travis-ci.org/Songmu/ghg.png?branch=main)][travis]
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![GoDoc](https://godoc.org/github.com/Songmu/ghg?status.svg)][godoc]
[![Coverage Status](https://codecov.io/gh/Songmu/ghg/branch/main/graph/badge.svg)][codecov]
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Songmu/ghg)][PkgGoDev]

[travis]: https://travis-ci.org/Songmu/ghg
[coveralls]: https://coveralls.io/r/Songmu/ghg?branch=master
[license]: https://github.com/Songmu/ghg/blob/master/LICENSE
[godoc]: https://godoc.org/github.com/Songmu/ghg
[codecov]: https://codecov.io/gh/Songmu/ghg
[license]: https://github.com/Songmu/ghg/blob/main/LICENSE
[PkgGoDev]: https://pkg.go.dev/github.com/Songmu/ghg

## Description

Get the executable from github releases

## Installation

% go get github.com/Songmu/ghg/cmd/ghg
% go install github.com/Songmu/ghg/cmd/ghg@latest

Built binaries are available on gihub releases.
<https://github.com/Songmu/ghg/releases>
Expand Down
12 changes: 0 additions & 12 deletions _tools/releng

This file was deleted.

2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
comment: false
github_checks: false
37 changes: 18 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
module github.com/Songmu/ghg

go 1.19

require (
github.com/Songmu/ghch v0.4.0 // indirect
github.com/Songmu/retry v0.1.0 // indirect
github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76
github.com/fhs/go-netrc v1.0.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/hashicorp/go-version v1.1.0 // indirect
github.com/jessevdk/go-flags v1.4.0
github.com/jingweno/go-sawyer v0.0.0-20140729165055-1999ae5763d6
github.com/jtacoma/uritemplates v1.0.0
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mholt/archiver v3.1.1+incompatible
github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 // indirect
github.com/mitchellh/go-homedir v0.0.0-20180523094522-3864e76763d9
github.com/mitchellh/ioprogress v0.0.0-20180201004757-6a23b12fa88e
github.com/nwaples/rardecode v0.0.0-20171029023500-e06696f847ae
github.com/octokit/go-octokit v0.4.1-0.20160312003706-812e91dfbd64
github.com/pierrec/lz4 v2.0.5+incompatible
github.com/pkg/errors v0.8.0
github.com/tcnksm/ghr v0.12.0 // indirect
github.com/tcnksm/go-gitconfig v0.1.2
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e // indirect
github.com/ulikunitz/xz v0.5.4
golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c // indirect
)

require (
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 // indirect
github.com/fhs/go-netrc v1.0.0 // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/jingweno/go-sawyer v0.0.0-20140729165055-1999ae5763d6 // indirect
github.com/jtacoma/uritemplates v1.0.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/nwaples/rardecode v0.0.0-20171029023500-e06696f847ae // indirect
github.com/onsi/gomega v1.24.2 // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/ulikunitz/xz v0.5.4 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
)
Loading