-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (129 loc) · 4.89 KB
/
Copy pathself-release.yaml
File metadata and controls
140 lines (129 loc) · 4.89 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Buildspace Release
on:
push:
branches: [main]
jobs:
check-labels:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
pull-requests: read
contents: read
outputs:
labels: ${{ steps.check.outputs.labels }}
steps:
- uses: actions/checkout@v5
- name: Check PR Labels
id: check
uses: ./.github/blocks/check-pr-label
with:
labels: '["release"]'
release-info:
needs: check-labels
if: fromJSON(needs.check-labels.outputs.labels).release
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
release_notes: ${{ steps.notes.outputs.final-message }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Determine Version
id: version
uses: ./.github/blocks/determine-publish-version
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
- name: Build Release Context
id: context
shell: bash
env:
PREVIOUS_VERSION: ${{ steps.version.outputs.previous-version }}
run: |
RANGE_START="v${PREVIOUS_VERSION}"
if [ -z "$PREVIOUS_VERSION" ] || [ "$PREVIOUS_VERSION" = "0.0.0" ]; then
COMMIT_LOG=$(git log --no-merges --format='- %h %s' -n 25)
FILE_LIST=$(git ls-tree -r --name-only HEAD | sed 's/^/- /' | head -100)
{
echo "summary=Initial release based on the current repository state."
echo "commits<<EOF"
echo "$COMMIT_LOG"
echo "EOF"
echo "files<<EOF"
echo "$FILE_LIST"
echo "EOF"
} >> "$GITHUB_OUTPUT"
exit 0
fi
COMMIT_LOG=$(git log --no-merges --format='- %h %s' "${RANGE_START}..${GITHUB_SHA}")
FILE_LIST=$(git diff --name-only "${RANGE_START}..${GITHUB_SHA}" | sed 's/^/- /' | head -100)
if [ -z "$COMMIT_LOG" ]; then
COMMIT_LOG="- No commit summary available."
fi
if [ -z "$FILE_LIST" ]; then
FILE_LIST="- No changed files detected."
fi
{
echo "summary=Changes since ${RANGE_START}."
echo "commits<<EOF"
echo "$COMMIT_LOG"
echo "EOF"
echo "files<<EOF"
echo "$FILE_LIST"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Generate Release Notes
id: notes
uses: openai/codex-action@v1
with:
codex-home: ${{ runner.temp }}/codex-release-notes
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
sandbox: read-only
prompt: |
Generate release notes for buildspace v${{ steps.version.outputs.version }}.
Use only the release context below. Do not run shell commands.
Release summary:
${{ steps.context.outputs.summary }}
Commits:
${{ steps.context.outputs.commits }}
Changed files:
${{ steps.context.outputs.files }}
REQUIREMENTS:
1. NO title - start with content directly
2. Plain language - like explaining to a friend
3. SHORT - 1-2 sentences per item
4. Group: ## New Features, ## Bug Fixes, ## Improvement, if they exist. For example, if there are no new features, bug fixes, or improvements, don't include them.
5. Only include breaking changes if they exist
6. Include commit SHAs if necessary. If the commit is large, don't include it.
7. 1-2 emojis max for personality
8. Code diffs ONLY if necessary. If the diff is large, don't include it.
The end goal is clear business technical writing that is easy to understand, use, and bring
delight to the user.
github-release:
needs: [check-labels, release-info]
if: fromJSON(needs.check-labels.outputs.labels).release
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Create GitHub Release
uses: ./.github/blocks/create-github-release
with:
version: ${{ needs.release-info.outputs.version }}
title: "buildspace v${{ needs.release-info.outputs.version }}"
notes: ${{ needs.release-info.outputs.release_notes }}
app-id: ${{ secrets.APP_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
update-skills:
needs: [check-labels, release-info, github-release]
if: fromJSON(needs.check-labels.outputs.labels).release
uses: ./.github/workflows/update-skills.yaml
with:
skills-need-update: true
skills-path: skills/buildspace
release-tag: v${{ needs.release-info.outputs.version }}
release-notes: ${{ needs.release-info.outputs.release_notes }}
use-blacksmith: true
secrets: inherit