mirror of
https://github.com/itchyny/mmv.git
synced 2025-12-26 22:24:58 +08:00
initialize repository
This commit is contained in:
commit
ac88fa99fe
9 changed files with 160 additions and 0 deletions
20
.github/workflows/ci.yaml
vendored
Normal file
20
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.x
|
||||
- name: Test
|
||||
run: make test
|
||||
- name: Lint
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin # will be removed
|
||||
make lint
|
||||
36
.github/workflows/release.yaml
vendored
Normal file
36
.github/workflows/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@master
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.x
|
||||
- name: Cross build
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin # remove when actions/setup-go does this
|
||||
make cross
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
- name: Upload
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin # remove when actions/setup-go does this
|
||||
make upload
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/goxz
|
||||
/mmv
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 itchyny
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
69
Makefile
Normal file
69
Makefile
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
BIN := mmv
|
||||
VERSION := $$(make -s show-version)
|
||||
VERSION_PATH := cmd/$(BIN)
|
||||
BUILD_LDFLAGS := "-s -w"
|
||||
GOBIN ?= $(shell go env GOPATH)/bin
|
||||
export GO111MODULE=on
|
||||
|
||||
.PHONY: all
|
||||
all: clean build
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) ./cmd/$(BIN)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
go install -ldflags=$(BUILD_LDFLAGS) ./...
|
||||
|
||||
.PHONY: show-version
|
||||
show-version: $(GOBIN)/gobump
|
||||
@gobump show -r $(VERSION_PATH)
|
||||
|
||||
$(GOBIN)/gobump:
|
||||
@cd && go get github.com/motemen/gobump/cmd/gobump
|
||||
|
||||
.PHONY: cross
|
||||
cross: $(GOBIN)/goxz
|
||||
goxz -n $(BIN) -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) ./cmd/$(BIN)
|
||||
|
||||
$(GOBIN)/goxz:
|
||||
cd && go get github.com/Songmu/goxz/cmd/goxz
|
||||
|
||||
.PHONY: test
|
||||
test: build
|
||||
go test -v ./...
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(GOBIN)/golint
|
||||
go vet ./...
|
||||
golint -set_exit_status ./...
|
||||
|
||||
$(GOBIN)/golint:
|
||||
cd && go get golang.org/x/lint/golint
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(BIN) goxz
|
||||
go clean
|
||||
|
||||
.PHONY: bump
|
||||
bump: $(GOBIN)/gobump
|
||||
ifneq ($(shell git status --porcelain),)
|
||||
$(error git workspace is dirty)
|
||||
endif
|
||||
ifneq ($(shell git rev-parse --abbrev-ref HEAD),master)
|
||||
$(error current branch is not master)
|
||||
endif
|
||||
@gobump up -w "$(VERSION_PATH)"
|
||||
git commit -am "bump up version to $(VERSION)"
|
||||
git tag "v$(VERSION)"
|
||||
git push origin master
|
||||
git push origin "refs/tags/v$(VERSION)"
|
||||
|
||||
.PHONY: upload
|
||||
upload: $(GOBIN)/ghr
|
||||
ghr "v$(VERSION)" goxz
|
||||
|
||||
$(GOBIN)/ghr:
|
||||
cd && go get github.com/tcnksm/ghr
|
||||
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# mmv [](https://github.com/itchyny/mmv/actions)
|
||||
7
cmd/mmv/main.go
Normal file
7
cmd/mmv/main.go
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Print("mmv")
|
||||
}
|
||||
3
go.mod
Normal file
3
go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module github.com/itchyny/mmv
|
||||
|
||||
go 1.13
|
||||
1
mmv.go
Normal file
1
mmv.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
package mmv
|
||||
Loading…
Add table
Add a link
Reference in a new issue