-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (87 loc) · 2.48 KB
/
release.yml
File metadata and controls
98 lines (87 loc) · 2.48 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
name: Release
on:
push:
branches: [main]
tags: ["v*"]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Set version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "version=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
else
echo "version=dev-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
fi
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
EXT=""
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; fi
go build -ldflags "-X github.com/alanmeadows/otto/internal/cli.Version=${{ steps.version.outputs.version }}" \
-o otto-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} ./cmd/otto
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: otto-${{ matrix.goos }}-${{ matrix.goarch }}
path: otto-*
dev-release:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Update dev release
uses: softprops/action-gh-release@v2
with:
tag_name: dev
name: Development Build
prerelease: true
make_latest: false
body: |
Rolling development build from the `main` branch.
Updated on every push. **Not a stable release.**
files: artifacts/*
github-release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*