-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.92 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (52 loc) · 1.92 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v1.2.3)"
required: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build binaries
run: |
VERSION="${{ github.event.inputs.tag || github.ref_name }}"
LDFLAGS="-s -w -X github.com/CampusTech/snipe2jamf/cmd.Version=${VERSION}"
GOOS=darwin GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o "dist/snipe2jamf-darwin-arm64" .
GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o "dist/snipe2jamf-linux-amd64" .
GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o "dist/snipe2jamf-linux-arm64" .
GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o "dist/snipe2jamf-windows-amd64.exe" .
- name: Generate release notes
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
VERSION: ${{ github.event.inputs.tag || github.ref_name }}
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${VERSION}$" | head -1)
if [ -n "$PREV_TAG" ]; then
SINCE=$(git log -1 --format=%aI "${PREV_TAG}")
else
SINCE="1970-01-01T00:00:00Z"
fi
export SINCE
python3 .github/scripts/gen_release_notes.py "$VERSION" "$PREV_TAG" > release_notes.md
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
body_path: release_notes.md
files: dist/*