Skip to content

Commit c88ca6d

Browse files
m4heshdmceachen
andauthored
Move repetitive build commands into environment variables (#989)
* Move repetitive build commands into environment variables * Merge 'https://github.com/mceachen/better-sqlite3/tree/dry-gha-989' Co-authored-by: mceachen <[email protected]> --------- Co-authored-by: mceachen <[email protected]>
1 parent f190fef commit c88ca6d

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- released
1313
workflow_dispatch: {}
1414

15+
env:
16+
NODE_BUILD_CMD: npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$'
17+
ELECTRON_BUILD_CMD: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex 'better_sqlite3.node$'
18+
1519
jobs:
1620
test:
1721
strategy:
@@ -67,12 +71,12 @@ jobs:
6771
with:
6872
node-version: 16
6973
- run: npm install --ignore-scripts
70-
- run: npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
71-
- run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
74+
- run: ${{ NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
75+
- run: ${{ ELECTRON_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
7276
- if: matrix.os == 'windows-2019'
73-
run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex 'better_sqlite3.node$' --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
77+
run: ${{ ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
7478
- if: matrix.os == 'macos-latest'
75-
run: npx --no-install prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex 'better_sqlite3.node$' --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
79+
run: ${{ ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
7680

7781
prebuild-alpine:
7882
name: Prebuild on alpine
@@ -83,7 +87,7 @@ jobs:
8387
- uses: actions/checkout@v3
8488
- run: apk add build-base git python3 --update-cache
8589
- run: npm install --ignore-scripts
86-
- run: npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}
90+
- run: ${{ NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
8791

8892
prebuild-alpine-arm:
8993
strategy:
@@ -102,7 +106,7 @@ jobs:
102106
apk add build-base git python3 --update-cache && \
103107
cd /tmp/project && \
104108
npm install --ignore-scripts && \
105-
npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}"
109+
${{ NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"
106110
107111
prebuild-linux-arm:
108112
strategy:
@@ -120,4 +124,4 @@ jobs:
120124
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:16 -c "\
121125
cd /tmp/project && \
122126
npm install --ignore-scripts && \
123-
npx --no-install prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 --include-regex 'better_sqlite3.node$' -u ${{ secrets.GITHUB_TOKEN }}"
127+
${{ NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)