You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Pkg Action
v2.2.2
This is a GitHub action that allows you to "compile" node projects with pkg. It supports:
- All
pkg
supported node versions x64|amd64
andaarch64|arm64
macos|linux|windows
.
If you are also looking to code sign/notarize the resulting binaries then check out @lando/code-sign-action.
- If you are looking to "cross compile" binaries across OS AND architecture then we recommend you matrix strategy across this actions
os
andarch
inputs instead ofruns-on
. This is neccessary becausearm64
compilation is currently emulated on Linux only. If you are compiling just onamd64|x64
then it's probably ok to useruns-on
. - If you are looking to "cross compile" binaries across OS AND architecture AND code sign/notarize the resulting binaries we recommend you first upload the artifacts and then download them to the
os
you need to do the code signing.
See Advanced Usage below for some examples of ^.
These keys must be set correctly for the action to work.
Name | Description | Example Value |
---|---|---|
entrypoint |
The binary entrypoint path. | bin/entrypoint.js |
These keys are set to sane defaults but can be modified as needed.
Name | Description | Default | Example |
---|---|---|---|
arch |
The architecture to build for. | amd64 |
x64 | amd64 | aarch64 | arm64 |
config |
The config file to use. | package.json |
config.json |
node-version |
The node version to package with. | node14 |
node8 | node10 | node12 | node14 | node16 | latest |
options |
Additional options and flags to pass into pkg. | null |
Additional pkg options |
os |
The operating system to build for. | ${{ runner.os }} |
linux | macos | win |
pkg |
The version on @vercel/pkg to use. | 5.8.0 |
latest |
upload |
Upload the artifacts. Useful if you need to grab them for downstream for things like code signing. | true |
false | true |
outputs:
file:
description: "The path to the generated binary."
value: ${{ steps.pkg-action.outputs.file }}
artifact-key:
description: "The artifact upload key."
value: ${{ steps.pkg-action.outputs.artifact-key }}
name: Package into node binary
uses: lando/pkg-action@v2
with:
entrypoint: bin/cli
ALL OPTIONS
name: Package into node binary
uses: lando/pkg-action@v2
with:
entrypoint: bin/cli
arch: arm64
config: package.json
node-version: node16
options: -C
os: win
upload: false
CROSS COMPILE ON ALL THE THINGS
runs-on: ubuntu-20.04
strategy:
matrix:
arch:
- x64
- arm64
node-version:
- node16
os:
- linux
- macos
- win
steps:
- name: Package into node binary
uses: lando/pkg-action@v2
with:
entrypoint: bin/cli
arch: ${{ matrix.arch }}
node-version: ${{ matrix.node-version }}
os: ${{ matrix.os }}
We try to log all changes big and small in both THE CHANGELOG and the release notes.
Create a release and publish to GitHub Actions Marketplace. Note that the release tag must be a semantic version.
Made with contrib.rocks.