Skip to content

Commit 1250ec2

Browse files
committed
updates to the readme, inclusion of both x64 and arm64 - debug
1 parent 614964e commit 1250ec2

File tree

7 files changed

+122
-2131
lines changed

7 files changed

+122
-2131
lines changed

.github/workflows/build-layer.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build lambda layer for sharp
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: '0 4 * * *'
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- name: Setup node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '^20.10.0'
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
- name: Install esbuild
27+
run: npm i -g [email protected]
28+
29+
- name: Install sharp - arm64
30+
run: npm i --save-exact --os=linux --cpu=arm64 --libc=glibc sharp
31+
- name: Remove musl-based binary # @npm/cli#6914
32+
run: rm -rf node_modules/@img/*-linuxmusl*
33+
- name: Get sharp version
34+
id: version
35+
uses: notiz-dev/github-action-json-property@release
36+
with:
37+
path: 'package.json'
38+
prop_path: 'dependencies.sharp'
39+
- name: esbuild - arm64
40+
run: esbuild --bundle ./node_modules/sharp/ --outfile=index.js --minify --format=cjs --platform=node
41+
- name: Zip - arm64
42+
run: |
43+
mkdir -p nodejs/node_modules/sharp/lib
44+
mv index.js nodejs/node_modules/sharp/lib/
45+
mv node_modules/sharp/package.json nodejs/node_modules/sharp/
46+
mv node_modules/sharp/LICENSE nodejs/node_modules/sharp/
47+
mv node_modules/sharp/lib/index.d.ts nodejs/node_modules/sharp/lib/
48+
mv node_modules/@img nodejs/node_modules/
49+
zip -r release-arm64 nodejs
50+
- name: Clean arm64
51+
run: rm -rf nodejs node_modules # keep package.json for keeping the version
52+
53+
- name: Install sharp - x64
54+
run: npm i --save-exact --os=linux --cpu=x64 --libc=glibc sharp
55+
- name: Remove musl-based binary # @npm/cli#6914
56+
run: rm -rf node_modules/@img/*-linuxmusl*
57+
- name: esbuild - x64
58+
run: esbuild --bundle ./node_modules/sharp/ --outfile=index.js --minify --format=cjs --platform=node
59+
- name: Zip - x64
60+
run: |
61+
mkdir -p nodejs/node_modules/sharp/lib
62+
mv index.js nodejs/node_modules/sharp/lib/
63+
mv node_modules/sharp/package.json nodejs/node_modules/sharp/
64+
mv node_modules/sharp/LICENSE nodejs/node_modules/sharp/
65+
mv node_modules/sharp/lib/index.d.ts nodejs/node_modules/sharp/lib/
66+
mv node_modules/@img nodejs/node_modules/
67+
zip -r release-x64 nodejs
68+
- name: Clean x64
69+
run: rm -rf nodejs node_modules # keep package.json for keeping the version
70+
71+
- name: Install sharp - all
72+
run: |
73+
npm i --os=linux --cpu=x64 --libc=glibc sharp
74+
npm i --os=linux --cpu=arm64 --libc=glibc sharp
75+
- name: Remove musl-based binary # @npm/cli#6914
76+
run: rm -rf node_modules/@img/*-linuxmusl*
77+
- name: esbuild - all
78+
run: esbuild --bundle ./node_modules/sharp/ --outfile=index.js --minify --format=cjs --platform=node
79+
- name: Zip - all
80+
run: |
81+
mkdir -p nodejs/node_modules/sharp/lib
82+
mv index.js nodejs/node_modules/sharp/lib/
83+
mv node_modules/sharp/package.json nodejs/node_modules/sharp/
84+
mv node_modules/sharp/LICENSE nodejs/node_modules/sharp/
85+
mv node_modules/sharp/lib/index.d.ts nodejs/node_modules/sharp/lib/
86+
mv node_modules/@img nodejs/node_modules/
87+
zip -r release-all nodejs
88+
89+
- name: Test
90+
run: |
91+
cp test.mjs nodejs/test.mjs
92+
node nodejs/test.mjs
93+
if [ ! -f test.png ]; then exit 1 ; fi
94+
95+
- name: Current version
96+
id: version_current
97+
run: echo "sharpver=$(cat PREVIOUS_VERSION.txt)" >> $GITHUB_ENV
98+
- name: Update PREVIOUS_VERSION.txt
99+
if: ${{ env.sharpver != steps.version.outputs.prop && github.event_name != 'pull_request' }}
100+
run: echo ${{steps.version.outputs.prop}} > PREVIOUS_VERSION.txt
101+
- name: Create commit
102+
uses: stefanzweifel/git-auto-commit-action@v4
103+
if: ${{ env.sharpver != steps.version.outputs.prop && github.event_name != 'pull_request' }}
104+
with:
105+
commit_message: ${{steps.version.outputs.prop}}
106+
file_pattern: PREVIOUS_VERSION.txt
107+
- name: Create release
108+
uses: softprops/action-gh-release@v1
109+
if: ${{ env.sharpver != steps.version.outputs.prop && github.event_name != 'pull_request' }}
110+
with:
111+
files: "release*"
112+
body: ${{steps.version.outputs.prop}}
113+
tag_name: ${{steps.version.outputs.prop}}

.github/workflows/docker-workflow.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)