-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: qwqcode <[email protected]>
- Loading branch information
Showing
7 changed files
with
206 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Release Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
- run: git fetch --prune --unshallow --tags -f | ||
|
||
# docker `golang-cross` image cache | ||
# `cache-go-cross-v1-18-1` | ||
- run: mkdir -p ~/docker-cache | ||
- name: docker image cache | ||
id: cache-go-cross-v1-18-1 | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/docker-cache | ||
# Adjust key to meet your cache time requirements e.g. | ||
# ${{ hashFiles(*) }} can be useful here to invalidate | ||
# cache on file changes | ||
key: cache-go-cross-v1-18-1 | ||
|
||
- if: steps.cache-go-cross-v1-18-1.outputs.cache-hit != 'true' | ||
run: | | ||
docker pull ghcr.io/goreleaser/goreleaser-cross:v1.18.1 | ||
docker save -o ~/docker-cache/golang-cross.tar ghcr.io/goreleaser/goreleaser-cross:v1.18.1 | ||
- if: steps.cache-go-cross-v1-18-1.outputs.cache-hit == 'true' | ||
run: docker load -i ~/docker-cache/golang-cross.tar | ||
|
||
# build | ||
- name: setup release environment | ||
run: |- | ||
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_ACCESS_TOKEN}}' > .release-env | ||
- name: build and release publish | ||
run: make release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
|
||
.history | ||
|
||
artalk-go.yml | ||
config.yml | ||
.release-env | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
project_name: artransfer | ||
|
||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=1 | ||
|
||
# build multi-platform | ||
builds: | ||
## Amd 64 | ||
|
||
# Linux (amd_64) | ||
- id: linux-amd64 | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
env: | ||
- CC=gcc | ||
- CXX=g++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: &common_ldflags | | ||
-X github.com/ArtalkJS/Artransfer-CLI/lib.Version={{.Version}} | ||
-X github.com/ArtalkJS/Artransfer-CLI/lib.CommitHash={{ .ShortCommit }} | ||
-s -w | ||
|
||
# Windows (amd_64) | ||
- id: windows-amd64 | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
env: | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: *common_ldflags | ||
|
||
# Darwin (amd_64) | ||
- id: darwin-amd64 | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
env: | ||
- CC=o64-clang | ||
- CXX=o64-clang++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: *common_ldflags | ||
|
||
## Arm | ||
|
||
# Linux (arm_v7) | ||
- id: linux-armhf | ||
goos: | ||
- linux | ||
goarch: | ||
- arm | ||
goarm: | ||
- 7 | ||
env: | ||
- CC=arm-linux-gnueabihf-gcc | ||
- CXX=arm-linux-gnueabihf-g++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: *common_ldflags | ||
|
||
# Linux (arm_64) | ||
- id: linux-arm64 | ||
goos: | ||
- linux | ||
goarch: | ||
- arm64 | ||
env: | ||
- CC=aarch64-linux-gnu-gcc | ||
- CXX=aarch64-linux-gnu-g++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: *common_ldflags | ||
|
||
# Darwin (arm_64) | ||
- id: darwin-arm64 | ||
goos: | ||
- darwin | ||
goarch: | ||
- arm64 | ||
env: | ||
- CC=oa64-clang | ||
- CXX=oa64-clang++ | ||
binary: "{{.ProjectName}}" | ||
main: ./main.go | ||
ldflags: *common_ldflags | ||
|
||
archives: | ||
- id: artransfer | ||
builds: | ||
- linux-amd64 | ||
- darwin-amd64 | ||
- windows-amd64 | ||
- linux-armhf | ||
- linux-arm64 | ||
- darwin-arm64 | ||
name_template: "{{.ProjectName}}_v{{.Version}}_{{.Os}}_{{.Arch}}{{.Arm}}" | ||
format: tar.gz | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
wrap_in_directory: false | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{.Version}}-SNAPSHOT-{{.ShortCommit}}" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^chore:' | ||
|
||
release: | ||
github: | ||
owner: ArtalkJS | ||
name: Artransfer-CLI | ||
prerelease: auto | ||
draft: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package lib | ||
|
||
// 版本信息 | ||
var ( | ||
Version string | ||
CommitHash string | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters