8
8
schedule :
9
9
- cron : ' 0 16 * * *'
10
10
workflow_dispatch :
11
+ inputs :
12
+ sharp_version :
13
+ description : ' Sharp version to build'
14
+ required : false
15
+ default : ' latest'
11
16
12
17
jobs :
13
18
build :
@@ -33,11 +38,21 @@ jobs:
33
38
34
39
- name : Install sharp (${{ matrix.arch }})
35
40
run : |
36
- if [ "${{ matrix.arch }}" = "all" ]; then
37
- npm i --os=linux --cpu=x64 --libc=glibc sharp
38
- npm i --os=linux --cpu=arm64 --libc=glibc sharp
41
+ VERSION="${{ github.event.inputs.sharp_version }}"
42
+ if [ "$VERSION" = "latest" ]; then
43
+ if [ "${{ matrix.arch }}" = "all" ]; then
44
+ npm i --os=linux --cpu=x64 --libc=glibc sharp
45
+ npm i --os=linux --cpu=arm64 --libc=glibc sharp
46
+ else
47
+ npm i --save-exact --os=linux --cpu=${{ matrix.arch }} --libc=glibc sharp
48
+ fi
39
49
else
40
- npm i --save-exact --os=linux --cpu=${{ matrix.arch }} --libc=glibc sharp
50
+ if [ "${{ matrix.arch }}" = "all" ]; then
51
+ npm i --os=linux --cpu=x64 --libc=glibc sharp@$VERSION
52
+ npm i --os=linux --cpu=arm64 --libc=glibc sharp@$VERSION
53
+ else
54
+ npm i --save-exact --os=linux --cpu=${{ matrix.arch }} --libc=glibc sharp@$VERSION
55
+ fi
41
56
fi
42
57
43
58
- name : Extract Sharp version
@@ -119,6 +134,15 @@ jobs:
119
134
path : ' artifacts/sharp-x64/nodejs/node_modules/sharp/package.json'
120
135
prop_path : ' version'
121
136
137
+ - name : Check if version is pre-release
138
+ id : prerelease
139
+ run : |
140
+ if [[ "${{ steps.version.outputs.prop }}" == *-* ]]; then
141
+ echo "is_prerelease=true" >> $GITHUB_ENV
142
+ else
143
+ echo "is_prerelease=false" >> $GITHUB_ENV
144
+ fi
145
+
122
146
- name : Skip if no version change
123
147
if : ${{ env.sharpver == steps.version.outputs.prop }}
124
148
run : echo "🧠 No Sharp update detected. Skipping release."
@@ -142,6 +166,7 @@ jobs:
142
166
files : artifacts/**/*.zip
143
167
body : Sharp version ${{ steps.version.outputs.prop }}
144
168
tag_name : ${{ steps.version.outputs.prop }}
169
+ prerelease : ${{ env.is_prerelease }}
145
170
146
171
- name : Notify Discord
147
172
if : ${{ env.sharpver != steps.version.outputs.prop }}
0 commit comments