-
Notifications
You must be signed in to change notification settings - Fork 8
143 lines (123 loc) · 4.35 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (123 loc) · 4.35 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
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build-and-release:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Extract version from tag
id: get_version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Create gradle.properties from template
shell: bash
run: |
cp gradle.properties.template gradle.properties
# Remove the hardcoded Java home path - GitHub Actions sets up Java correctly
sed -i '/^org.gradle.java.home=/d' gradle.properties
# Update version and build configuration
sed -i 's/^pluginVersion=.*/pluginVersion=${{ steps.get_version.outputs.VERSION }}/' gradle.properties
sed -i 's/^buildConfiguration=.*/buildConfiguration=Release/' gradle.properties
echo "Created gradle.properties with version ${{ steps.get_version.outputs.VERSION }}"
cat gradle.properties
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: |
node_modules
third-party/vscode-unreal-angelscript/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
- name: Build plugin
run: ./gradlew buildPlugin --no-daemon --stacktrace
shell: bash
- name: Debug - List output directory
if: always()
shell: bash
run: |
echo "Contents of output directory:"
ls -lah output/ || echo "output/ directory does not exist"
echo ""
echo "Contents of build/distributions:"
ls -lah build/distributions/ || echo "build/distributions/ does not exist"
- name: Verify build outputs
shell: bash
run: |
if [ ! -f "output/Scriptacus.RiderUnrealAngelscript-${{ steps.get_version.outputs.VERSION }}.zip" ]; then
echo "Error: Plugin ZIP not found!"
exit 1
fi
echo "Build artifact verified:"
ls -lh output/*.zip
- name: Extract changelog for this version
id: changelog
shell: bash
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
# Extract the section for this version from CHANGELOG.md
CHANGELOG=$(awk "/## ${VERSION}/,/^## [0-9]/" CHANGELOG.md | sed '1d;$d' | sed '/^$/d')
# If changelog is empty, use a default message
if [ -z "$CHANGELOG" ]; then
CHANGELOG="Release version ${VERSION}"
fi
# Save to file for multiline content
echo "$CHANGELOG" > changelog_body.txt
echo "Extracted changelog:"
cat changelog_body.txt
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: "v${{ steps.get_version.outputs.VERSION }}"
body_path: changelog_body.txt
draft: false
prerelease: false
files: |
output/Scriptacus.RiderUnrealAngelscript-${{ steps.get_version.outputs.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: plugin-artifacts
path: |
output/*.zip
output/*.nupkg
retention-days: 90