Artifacts
GitHub Actions artifacts management.
π‘
This command is usually used in the publish step, before the npm publish
command and after the Download artifacts
step.
Flags List
Flag | Type/Default Value | Description |
---|---|---|
-d ,--dir | String /artifacts | The source dir which contains all the artifacts output in build phase. |
--dist | String /npm | The dist dir where the native addon will be copied into. |
How does it work
Assume you have a project which builds native addon for these platform:
x86_64-apple-darwin
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
aarch64-apple-darwin
aarch64-linux-android
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
aarch64-pc-windows-msvc
armv7-unknown-linux-gnueabihf
arm-linux-androideabi
x86_64-unknown-linux-musl
x86_64-unknown-freebsd
i686-pc-windows-msvc
And you can download these artifacts via actions/download-artifact
:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
Now the directory structure will look like this:
directory structure
.
βββ artifacts
| βββ bindings-x86_64-apple-darwin
| βΒ Β βββ blake.darwin-x64.node
| βββ bindings-x86_64-pc-windows-msvc
| βΒ Β βββ blake.win32-x64.node
| βββ bindings-x86_64-unknown-linux-gnu
| βΒ Β βββ blake.linux-x64-gnu.node
| βββ bindings-aarch64-apple-darwin
| βΒ Β βββ blake.darwin-arm64.node
| βββ bindings-aarch64-linux-android
| βΒ Β βββ blake.android-arm64.node
| βββ bindings-aarch64-unknown-linux-gnu
| βΒ Β βββ blake.linux-arm64-gnu.node
| βββ bindings-aarch64-unknown-linux-musl
| βΒ Β βββ blake.linux-arm64-musl.node
| βββ bindings-aarch64-pc-windows-msvc
| βΒ Β βββ blake.win32-arm64-msvc.node
| βββ bindings-armv7-unknown-linux-gnueabihf
| βΒ Β βββ blake.linux-arm-gnueabihf.node
| βββ bindings-arm-linux-androideabi
| βΒ Β βββ blake.android-arm-eabi.node
| βββ bindings-x86_64-unknown-linux-musl
| βΒ Β βββ blake.linux-x64-musl.node
| βββ bindings-x86_64-unknown-freebsd
| βΒ Β βββ blake.freebsd-x64.node
| βββ bindings-i686-pc-windows-msvc
| βββ blake.win32-ia32-msvc.node
βββ npm
βΒ Β βββ android-arm-eabi
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ android-arm64
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ darwin-arm64
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ darwin-x64
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ freebsd-x64
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm-gnueabihf
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm64-gnu
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm64-musl
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-x64-gnu
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-x64-musl
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-arm64-msvc
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-ia32-msvc
βΒ Β βΒ Β βββ README.md
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-x64-msvc
βΒ Β βββ README.md
βΒ Β βββ package.json
As you can see, we need to copy all .node
files into the npm
directory so that we can publish them via the napi prepublish
command.
napi artifacts
command will do this job for you. Assume the -d
flag and --dist
flags are the default value, and the directory structure is the same as below. After napi artifacts
command run, the directory structure will become:
directory structure
.
βββ artifacts
βββ npm
βΒ Β βββ android-arm-eabi
βΒ Β βΒ Β βββ README.md
| | βββ blake.android-arm-eabi.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ android-arm64
βΒ Β βΒ Β βββ README.md
| | βββ blake.android-arm64.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ darwin-arm64
βΒ Β βΒ Β βββ README.md
| | βββ blake.darwin-arm64.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ darwin-x64
βΒ Β βΒ Β βββ README.md
| | βββ blake.darwin-x64.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ freebsd-x64
βΒ Β βΒ Β βββ README.md
| | βββ blake.freebsd-x64.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm-gnueabihf
βΒ Β βΒ Β βββ README.md
| | βββ blake.linux-arm-gnueabihf.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm64-gnu
βΒ Β βΒ Β βββ README.md
| | βββ blake.linux-arm64-gnu.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-arm64-musl
βΒ Β βΒ Β βββ README.md
| | βββ blake.linux-arm64-musl.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-x64-gnu
βΒ Β βΒ Β βββ README.md
| | βββ blake.linux-x64-gnu.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ linux-x64-musl
βΒ Β βΒ Β βββ README.md
| | βββ blake.linux-x64-musl.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-arm64-msvc
βΒ Β βΒ Β βββ README.md
| | βββ blake.win32-arm64-msvc.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-ia32-msvc
βΒ Β βΒ Β βββ README.md
| | βββ blake.win32-ia32-msvc.node
βΒ Β βΒ Β βββ package.json
βΒ Β βββ win32-x64-msvc
βΒ Β βββ README.md
| βββ blake.win32-x64-msvc.node
βΒ Β βββ package.json