File tree Expand file tree Collapse file tree 2 files changed +87
-1
lines changed
Expand file tree Collapse file tree 2 files changed +87
-1
lines changed Original file line number Diff line number Diff line change 77# Caching from
88# https://github.com/docker/build-push-action/blob/primary/docs/advanced/cache.md'
99
10- name : Releases
10+ name : Docker
1111permissions :
1212 contents : read
1313on :
Original file line number Diff line number Diff line change 1+ name : Release
2+ permissions :
3+ contents : read
4+ packages : read
5+ on :
6+ push :
7+ tags : [ 'v*.*.*' ]
8+ paths :
9+ - ' go.mod'
10+ - ' go.sum'
11+ - ' **/*.go'
12+ workflow_dispatch :
13+ inputs :
14+ build_binaries :
15+ description : ' Build distributable binaries'
16+ type : boolean
17+ required : false
18+
19+ jobs :
20+ # Binaries will build visus for a variety of common platforms. This
21+ # job only runs on pushes to a target branch or tag or in response to
22+ # a manual run that requests binaries.
23+ binaries :
24+ name : Binaries
25+ if : ${{ github.event_name == 'push' || inputs.build_binaries }}
26+ runs-on : ubuntu-latest
27+ strategy :
28+ matrix :
29+ include :
30+ - os : linux
31+ arch : amd64
32+ - os : linux
33+ arch : arm64
34+ - os : darwin
35+ arch : arm64
36+ - os : darwin
37+ arch : amd64
38+ - os : windows
39+ arch : amd64
40+ ext : .exe
41+ - os : windows
42+ arch : arm64
43+ ext : .exe
44+ env :
45+ BUILDNAME : visus-${{ matrix.os }}-${{ matrix.arch }}
46+ OUTPUT : visus-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
47+ steps :
48+ - uses : actions/checkout@v3
49+
50+ # Use separate build caches for each target platform.
51+ - name : Write cache key
52+ run : echo '${{ github.job }} ${{ toJSON(matrix) }} ${{ hashFiles('go.sum') }}' > CACHE_KEY
53+
54+ - name : Set up Go
55+ uses : actions/setup-go@v3
56+ with :
57+ go-version-file : ' go.mod'
58+ cache : true
59+ cache-dependency-path : CACHE_KEY
60+
61+ - name : Create version file
62+ run : git describe --tags --always --dirty > VERSION.txt
63+
64+ - name : Build
65+ run : >
66+ go
67+ build
68+ -v
69+ -ldflags="-s -w"
70+ -o $OUTPUT
71+ .
72+ env :
73+ CGO_ENABLED : 0
74+ GOOS : ${{ matrix.os }}
75+ GOARCH : ${{ matrix.arch }}
76+ - name : Upload
77+ uses : actions/upload-artifact@v3
78+ with :
79+ name : ${{ env.BUILDNAME }}
80+ path : |
81+ ${{ env.OUTPUT }}
82+ README.md
83+ VERSION.txt
84+ LICENSE
85+ examples/*.txt
86+ if-no-files-found : error
You can’t perform that action at this time.
0 commit comments