-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (102 loc) · 3.29 KB
/
release-agents.yml
File metadata and controls
116 lines (102 loc) · 3.29 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
name: Release agent configs
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- major
- minor
- patch
default: patch
target:
description: "Branch or commit SHA to tag"
required: false
default: main
permissions:
contents: write
jobs:
create-tag:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Calculate next version tag
id: version
shell: bash
run: |
set -euo pipefail
latest="$(git tag --list 'v*' --sort=-version:refname | head -n 1)"
bump="${{ inputs.bump }}"
if [ -z "$latest" ]; then
next="v$(tr -d '\n' < .version)"
else
version="${latest#v}"
IFS='.' read -r major minor patch <<< "$version"
case "$bump" in
major)
major=$((major + 1))
minor=0
patch=0
;;
minor)
minor=$((minor + 1))
patch=0
;;
patch)
patch=$((patch + 1))
;;
esac
next="v${major}.${minor}.${patch}"
fi
echo "tag=$next" >> "$GITHUB_OUTPUT"
echo "Selected version: $next"
- name: Create and push tag
run: |
git tag "${{ steps.version.outputs.tag }}" "${{ inputs.target }}"
git push origin "${{ steps.version.outputs.tag }}"
release:
needs: create-tag
if: always() && (github.event_name == 'push' || needs.create-tag.result == 'success')
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Prepare release assets
run: |
mkdir -p dist
cp "config/.opencode/agent/Shared Context.md" "dist/Shared Context.md"
cp "config/.claude/agents/shared-context.md" "dist/shared-context.md"
- name: Prepare release notes
run: |
cat > dist/release-notes.md <<'EOF'
## Agent files
- OpenCode: `config/.opencode/agent/Shared Context.md` (asset: `Shared Context.md`)
- Claude: `config/.claude/agents/shared-context.md` (asset: `shared-context.md`)
EOF
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && needs.create-tag.outputs.tag || github.ref_name }}
name: Shared Context agents ${{ github.event_name == 'workflow_dispatch' && needs.create-tag.outputs.tag || github.ref_name }}
generate_release_notes: true
body_path: dist/release-notes.md
files: |
dist/Shared Context.md
dist/shared-context.md