forked from dnote/dnote
-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (62 loc) · 1.95 KB
/
release-cli.yml
File metadata and controls
77 lines (62 loc) · 1.95 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
name: Release CLI
on:
push:
tags:
- 'cli-v*'
jobs:
release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '>=1.25.0'
- name: Extract version from tag
id: version
run: |
TAG=${GITHUB_REF#refs/tags/cli-v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Releasing version: $TAG"
- name: Install dependencies
run: make install
- name: Run CLI tests
run: make test-cli
- name: Run E2E tests
run: make test-e2e
- name: Build CLI
run: make version=${{ steps.version.outputs.version }} build-cli
- name: Generate changelog
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="cli-v${VERSION}"
# Find previous CLI tag
PREV_TAG=$(git tag --sort=-version:refname | grep "^cli-" | grep -v "^${TAG}$" | head -n 1)
if [ -z "$PREV_TAG" ]; then
echo "Error: No previous CLI tag found"
echo "This appears to be the first release."
exit 1
fi
./scripts/generate-changelog.sh cli "$TAG" "$PREV_TAG" > /tmp/changelog.txt
cat /tmp/changelog.txt
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="cli-v${VERSION}"
# Determine if prerelease (version not matching major.minor.patch)
FLAGS=""
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
FLAGS="--prerelease"
fi
gh release create "$TAG" \
build/cli/*.tar.gz \
build/cli/*_checksums.txt \
$FLAGS \
--title="$TAG" \
--notes-file=/tmp/changelog.txt \
--draft