-
Notifications
You must be signed in to change notification settings - Fork 225
153 lines (131 loc) · 4.72 KB
/
release-asset.yml
File metadata and controls
153 lines (131 loc) · 4.72 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
name: Release
permissions:
contents: write
on:
push:
tags:
- 'v*'
jobs:
# Validate that the tag matches VERSION file
validate:
name: Validate release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Validate version consistency
run: |
VERSION="$(cat ./VERSION | tr -d '[:space:]')"
TAG_VERSION="${GITHUB_REF_NAME#v}"
if [[ "$VERSION" != "$TAG_VERSION" ]]; then
echo "❌ VERSION file ($VERSION) does not match tag ($TAG_VERSION)"
exit 1
fi
echo "✅ Version validation passed: $VERSION"
# Build the release artifacts
build:
name: Build release artifacts
runs-on: ubuntu-22.04
needs: validate
outputs:
version: ${{ steps.version.outputs.version }}
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
steps:
- uses: actions/checkout@v5
- name: Extract version info
id: version
run: |
VERSION="$(cat ./VERSION | tr -d '[:space:]')"
echo "version=$VERSION" >> $GITHUB_OUTPUT
if [[ "$VERSION" == *"-rc."* ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Set up BEAM
uses: erlef/setup-beam@v1
with:
elixir-version: 1.19.x
otp-version: 28.x
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
_build
deps
key: release-${{ hashFiles('**/mix.lock') }}
restore-keys: |
release-
- name: Install dependencies
run: mix deps.get
- name: Build release
run: |
mix elixir_ls.release2 -o ./release
zip -jr elixir-ls-v${{ steps.version.outputs.version }}.zip ./release
- name: Upload build artifact
uses: actions/upload-artifact@v5
with:
name: elixir-ls-${{ steps.version.outputs.version }}
path: elixir-ls-v${{ steps.version.outputs.version }}.zip
retention-days: 30
# Create GitHub release
release:
name: Create GitHub release
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Needed for changelog generation
- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: elixir-ls-${{ needs.build.outputs.version }}
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${{ needs.build.outputs.version }}"
# Extract changelog section for this version
if grep -q "### v$VERSION:" CHANGELOG.md; then
# Get the section for this version
CHANGELOG_SECTION=$(awk "/### v$VERSION:/,/### v[0-9]/{if(/### v[0-9]/ && !/### v$VERSION:/) exit; print}" CHANGELOG.md | head -n -1)
# Remove the version header line and clean up
CHANGELOG_CONTENT=$(echo "$CHANGELOG_SECTION" | tail -n +2 | sed '/^$/N;/^\n$/d')
# Save to file and output
echo "$CHANGELOG_CONTENT" > release_notes.md
echo "changelog_found=true" >> $GITHUB_OUTPUT
else
echo "No changelog found for version $VERSION" > release_notes.md
echo "changelog_found=false" >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: elixir-ls-v${{ needs.build.outputs.version }}.zip
body_path: release_notes.md
draft: true
prerelease: ${{ needs.build.outputs.is_prerelease == 'true' }}
name: "ElixirLS ${{ needs.build.outputs.version }}"
tag_name: "v${{ needs.build.outputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Run final validation tests on the release
test_release:
name: Test release artifact
runs-on: ubuntu-22.04
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: elixir-ls-${{ needs.build.outputs.version }}
- name: Test release artifact
run: |
# Basic smoke test - extract and verify structure
unzip -q elixir-ls-v${{ needs.build.outputs.version }}.zip
# Check that essential files exist
test -f language_server.sh || exit 1
test -f debug_adapter.sh || exit 1
# Check that the scripts are executable
test -x language_server.sh || exit 1
test -x debug_adapter.sh || exit 1
echo "✅ Release artifact validation passed"