Skip to content

Commit 633bb2a

Browse files
committed
deal with pre-releases
1 parent 7649503 commit 633bb2a

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

.github/workflows/build-layers.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
schedule:
99
- cron: '0 16 * * *'
1010
workflow_dispatch:
11+
inputs:
12+
sharp_version:
13+
description: 'Sharp version to build'
14+
required: false
15+
default: 'latest'
1116

1217
jobs:
1318
build:
@@ -33,11 +38,21 @@ jobs:
3338

3439
- name: Install sharp (${{ matrix.arch }})
3540
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
3949
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
4156
fi
4257
4358
- name: Extract Sharp version
@@ -119,6 +134,15 @@ jobs:
119134
path: 'artifacts/sharp-x64/nodejs/node_modules/sharp/package.json'
120135
prop_path: 'version'
121136

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+
122146
- name: Skip if no version change
123147
if: ${{ env.sharpver == steps.version.outputs.prop }}
124148
run: echo "🧠 No Sharp update detected. Skipping release."
@@ -142,6 +166,7 @@ jobs:
142166
files: artifacts/**/*.zip
143167
body: Sharp version ${{ steps.version.outputs.prop }}
144168
tag_name: ${{ steps.version.outputs.prop }}
169+
prerelease: ${{ env.is_prerelease }}
145170

146171
- name: Notify Discord
147172
if: ${{ env.sharpver != steps.version.outputs.prop }}

0 commit comments

Comments
 (0)