-
Notifications
You must be signed in to change notification settings - Fork 59
216 lines (189 loc) · 5.6 KB
/
release.yaml
File metadata and controls
216 lines (189 loc) · 5.6 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Release YAMLScript
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.2.3)'
required: true
type: string
defaults:
run:
shell: bash
env:
VERSION: ${{ inputs.version }}
GRAALVM_VERSION: '22.3.0'
JAVA_VERSION: '17'
jobs:
verify-release:
name: Verify Release Prerequisites
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check tag exists
run: |
if ! git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "ERROR: Tag $VERSION does not exist"
echo "Please run 'make release o=OLD n=$VERSION' locally first"
exit 1
fi
echo "✓ Tag $VERSION exists"
- name: Check tag points to current commit
run: |
TAG_COMMIT=$(git rev-parse "$VERSION^{commit}")
HEAD_COMMIT=$(git rev-parse HEAD)
if [[ $TAG_COMMIT != $HEAD_COMMIT ]]; then
echo "ERROR: Tag $VERSION does not point to HEAD"
echo "Tag commit: $TAG_COMMIT"
echo "HEAD commit: $HEAD_COMMIT"
exit 1
fi
echo "✓ Tag $VERSION points to HEAD"
- name: Check no existing release with assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "$VERSION" --json assets --jq '.assets | length' \
2>/dev/null | grep -q '^[1-9]'; then
echo "ERROR: Release $VERSION already has assets"
echo "Delete the release first if you want to rebuild"
exit 1
fi
echo "✓ No existing release assets found"
create-release:
name: Create GitHub Release
needs: verify-release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: Extract release notes from Changes file
id: extract_notes
run: |
if [[ -f Changes ]]; then
# Extract changes for this version from Changes file
awk '/^- version: '"$VERSION"'$/,/^- version:/ {
if (/^- version: '"$VERSION"'$/) next;
if (/^- version:/) exit;
if (/^ changes:/) next;
if (/^ date:/) next;
print
}' Changes | sed 's/^ //' > release-notes.txt
if [[ ! -s release-notes.txt ]]; then
echo "Release $VERSION" > release-notes.txt
fi
else
echo "Release $VERSION" > release-notes.txt
fi
echo "Release notes:"
cat release-notes.txt
- name: Create GitHub Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$VERSION" \
--title "YAMLScript $VERSION" \
--notes-file release-notes.txt \
--draft=false \
--prerelease=false
build-linux-x64:
name: Build Linux x64
needs: create-release
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential zlib1g-dev
- name: Build and create release archives
run: |
make -C ys build
make -C libys build
make release-build
- name: List created archives
run: ls -lh ys-*.tar.xz libys-*.tar.xz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: |
ys-*.tar.xz
libys-*.tar.xz
retention-days: 7
build-macos-arm64:
name: Build macOS ARM64 (Apple Silicon)
needs: create-release
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build and create release archives
run: |
make -C ys build
make -C libys build
make release-build
- name: List created archives
run: ls -lh ys-*.tar.xz libys-*.tar.xz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-arm64
path: |
ys-*.tar.xz
libys-*.tar.xz
retention-days: 7
upload-assets:
name: Upload Release Assets
needs:
- build-linux-x64
- build-macos-arm64
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Prepare release assets
run: |
find . -type f -name "*.tar.xz" -exec mv {} . \;
ls -lh *.tar.xz
- name: Upload assets to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "$VERSION" ys-*.tar.xz libys-*.tar.xz --clobber
echo "Release $VERSION complete!"
gh release view "$VERSION"