-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (78 loc) · 2.35 KB
/
Copy pathrelease.yml
File metadata and controls
99 lines (78 loc) · 2.35 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ubuntu-latest-go-1.22-${{ hashFiles('**/go.sum') }}
restore-keys: |
ubuntu-latest-go-1.22-
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -v ./...
- name: Run benchmarks
run: go test -bench=. -benchmem -run=^$ ./...
- name: Generate coverage report
run: go test -coverprofile=coverage.out -covermode=atomic ./...
- name: Create release archives
run: |
# Create version string from tag
VERSION=${GITHUB_REF#refs/tags/}
# Create release directory
mkdir -p release
# Generate documentation
go doc -all > release/doc.txt
# Create coverage HTML
go tool cover -html=coverage.out -o release/coverage.html
# Copy important files
cp coverage.out release/
cp README.md release/
cp LICENSE release/
cp go.mod release/
cp go.sum release/
# Create tarball
tar -czf release/float-${VERSION}.tar.gz release/
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
## Changes
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
## Installation
```bash
go get github.com/jenska/float@${{ github.ref }}
```
draft: false
prerelease: false
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release/float-${{ github.ref }}.tar.gz
asset_name: float-${{ github.ref }}.tar.gz
asset_content_type: application/gzip