未验证 提交 fdfa2989 编写于 作者: LinuxSuRen's avatar LinuxSuRen 提交者: GitHub

Add goreleaser config file (#347)

* Add goreleaser config file

* Change the name template

* Change the name template of nfpms

* Add goos freedsd and windows

* Add linux and darwin for the go os

* Add sign for the binary files

* Remove sign for the binary files

* Skip changelog

* Change the snapshot

* Use goreleaser to build jcli

* Checks if goreleaser configuration is valid

* Fix the wrong cmd of gorelease
上级 95c6015d
......@@ -18,14 +18,30 @@ jobs:
- name: Build
run: |
export PATH=$PATH:${PWD}/bin:$GOPATH/bin:/home/runner/go/bin
make clean go-bindata-download-linux tools init release
git fetch --prune --unshallow
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist --snapshot
- name: Publish Release
run: |
git clone https://github.com/jenkins-zh/jcli-repo
cp release/checksums.txt jcli-repo
cp release/jcli-darwin-386.tar.gz jcli-repo
cp release/jcli-darwin-amd64.tar.gz jcli-repo
cp release/jcli-darwin-amd64.tar.gz jcli-repo
cp release/jcli-freebsd-386.tar.gz jcli-repo
cp release/jcli-freebsd-amd64.tar.gz jcli-repo
cp release/jcli-linux-32bit.deb jcli-repo
cp release/jcli-linux-32bit.rpm jcli-repo
cp release/jcli-linux-386.tar.gz jcli-repo
cp release/jcli-linux-64bit.deb jcli-repo
cp release/jcli-linux-64bit.rpm jcli-repo
cp release/jcli-linux-amd64.tar.gz jcli-repo
cp release/jcli-windows-386.tar.gz jcli-repo
cd jcli-repo && git config --local user.email "rick@jenkins-zh.cn" && git config --local user.name "rick" && git add . && git commit -m 'Auto commit by bot' && git push https://linuxsuren:${{ secrets.GITHUB_SECRETS }}@github.com/jenkins-zh/jcli-repo.git
cp release/jcli-windows-386.zip jcli-repo
cp release/jcli-windows-amd64.zip jcli-repo
cd jcli-repo && git config --local user.email "361981269@qq.com" && git config --local user.name "rick" && git add . && git commit -m 'Auto commit by rick bot' && git push https://linuxsuren:${{ secrets.GITHUB_SECRETS }}@github.com/jenkins-zh/jcli-repo.git
- name: backup
uses: jenkins-zh/git-backup-actions@v0.0.3
......
......@@ -20,6 +20,12 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: check
- name: Build
run: |
export PATH=$PATH:${PWD}/bin:$GOPATH/bin:/home/runner/go/bin
......
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: jcli
before:
hooks:
- make gen-data
builds:
- env:
- CGO_ENABLED=0
binary: jcli
goos:
- freebsd
- windows
- linux
- darwin
ldflags:
- -X github.com/jenkins-zh/jenkins-cli/app.version={{.Version}}
- -X github.com/jenkins-zh/jenkins-cli/app.commit={{.ShortCommit}}
dist: release
archives:
- name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
replacements:
darwin: darwin
linux: linux
windows: windows
386: 386
amd64: amd64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next-{{.ShortCommit}}"
changelog:
skip: true
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
brews:
-
name: jcli
github:
owner: jenkins-zh
name: homebrew-jcli
folder: Formula
homepage: "https://github.com/jenkins-zh/jenkins-cli"
description: Jenkins CLI allows you manage your Jenkins as an easy way
test: |
version_output = shell_output("#{bin}/jcli version")
assert_match version.to_s, version_output
install: |
bin.install name
# Install bash completion
output = Utils.popen_read("#{bin}/jcli completion")
(bash_completion/"jcli").write output
# Install zsh completion
output = Utils.popen_read("#{bin}/jcli completion --type zsh")
(zsh_completion/"_jcli").write output
prefix.install_metafiles
nfpms:
- file_name_template: "{{ .Binary }}-{{.Os}}-{{.Arch}}"
homepage: https://github.com/jenkins-zh/jenkins-cli
description: Jenkins CLI allows you manage your Jenkins as an easy way
maintainer: rick <rick@jenkins-zh.cn>
license: MIT
vendor: Jenkins
formats:
- deb
- rpm
bindir: /usr/bin
replacements:
amd64: 64bit
386: 32bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: linux
windows: windows
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册