-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (99 loc) · 3.16 KB
/
publish.yaml
File metadata and controls
100 lines (99 loc) · 3.16 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
name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
inputs:
publish:
description: "Publish to NPM"
required: false
type: boolean
vulkan:
description: "Build a Vulkan Binary"
required: false
type: boolean
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- if: ${{contains(matrix.os, 'windows')}}
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: amd64
- uses: lukka/get-cmake@v3.30.0
- if: ${{contains(matrix.os, 'ubuntu')}}
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: libc6-dev
- name: Install CUDA (Linux)
env:
cuda: "12.5.1"
if: ${{contains(matrix.os, 'ubuntu') && !inputs.vulkan}}
run: ./cuda-cmake-github-actions/scripts/actions/install_cuda_ubuntu.sh
shell: bash
- name: Install CUDA (Windows)
env:
cuda: "12.5.1"
visual_studio: "Visual Studio 17 2022"
if: ${{contains(matrix.os, 'windows') && !inputs.vulkan}}
run: ./cuda-cmake-github-actions/scripts/actions/install_cuda_windows.ps1
shell: powershell
- uses: humbletim/install-vulkan-sdk@c2aa128094d42ba02959a660f03e0a4e012192f9
if: ${{ inputs.vulkan }}
with:
version: 1.3.296.0
cache: true
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run pkg-prebuilds-copy
- uses: actions/upload-artifact@v4
with:
name: node-addon-binary-${{ matrix.os }}
path: prebuilds/
retention-days: 1
publish:
needs:
- build
runs-on: ubuntu-22.04
permissions:
contents: write
id-token: write
environment: "NPM Publish"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- uses: actions/download-artifact@v4
with:
pattern: node-addon-binary-*
path: prebuilds
merge-multiple: true
- uses: geekyeggo/delete-artifact@v5
with:
name: node-addon-binary-*
- run: npm ci
- run: npm publish --provenance --access public
if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm pack
- uses: actions/upload-artifact@v4
if: github.event_name != 'release'
with:
name: lmagder-node-stable-diffusion-cpp
path: lmagder-node-stable-diffusion-cpp-*.tgz
- run: gh release upload ${{github.event.release.tag_name}} lmagder-node-stable-diffusion-cpp-*.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release'