-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (110 loc) · 3.3 KB
/
Copy pathrelease.yaml
File metadata and controls
122 lines (110 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Release binaries
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag, for example v0.1.0"
required: true
type: string
name:
description: "Release name"
required: false
type: string
prerelease:
description: "Mark release as prerelease"
required: true
default: true
type: boolean
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.goos }}-${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
ext: ""
archive: tar.gz
- goos: linux
goarch: arm64
ext: ""
archive: tar.gz
- goos: darwin
goarch: amd64
ext: ""
archive: tar.gz
- goos: darwin
goarch: arm64
ext: ""
archive: tar.gz
- goos: windows
goarch: amd64
ext: ".exe"
archive: zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Test
run: go test ./...
- name: Build binaries
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
set -euo pipefail
mkdir -p dist/package
go build -trimpath -ldflags="-s -w" -o "dist/package/geoforge${{ matrix.ext }}" ./cmd/builder
go build -trimpath -ldflags="-s -w" -o "dist/package/geoforge-qualitycheck${{ matrix.ext }}" ./cmd/qualitycheck
cp README.md LICENSE THIRD_PARTY_DATA.md admin.env.example dist/package/
- name: Package tar.gz
if: matrix.archive == 'tar.gz'
run: |
set -euo pipefail
name="geoforge_${{ github.event.inputs.tag }}_${{ matrix.goos }}_${{ matrix.goarch }}"
mv dist/package "dist/${name}"
tar -C dist -czf "dist/${name}.tar.gz" "${name}"
- name: Package zip
if: matrix.archive == 'zip'
run: |
set -euo pipefail
name="geoforge_${{ github.event.inputs.tag }}_${{ matrix.goos }}_${{ matrix.goarch }}"
mv dist/package "dist/${name}"
cd dist
zip -r "${name}.zip" "${name}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: geoforge-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.tar.gz
dist/*.zip
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag }}
target_commitish: ${{ github.sha }}
name: ${{ github.event.inputs.name || github.event.inputs.tag }}
prerelease: ${{ github.event.inputs.prerelease }}
generate_release_notes: true
files: release-assets/*