Build and publish NPM #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish NPM | |
on: | |
workflow_dispatch: | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
NODE_VERSION: "18.16.0" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runner: ["buildjet-2vcpu-ubuntu-2204", "buildjet-2vcpu-ubuntu-2204-arm"] | |
runs-on: ${{ matrix.runner }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: "https://npm.pkg.github.com/" | |
scope: "@luxonis" | |
- name: Build | |
run: | | |
sudo apt-get update && sudo apt-get install -y uidmap slirp4netns dbus-user-session | |
wget -O podman.tar "https://hub-agent.luxonis.com/?podman=4.2.0&arch=$(uname -m)" | |
sudo tar -C / -xvf podman.tar --strip-components=2 | |
rm -rf podman.tar | |
sudo chmod +x /usr/bin/crun | |
sudo mkdir /etc/containers || true | |
sudo cp ./resources/podman-policy.json /etc/containers/policy.json | |
sudo cp ./resources/podman-containers.conf /etc/containers/containers.conf | |
sudo chmod -R 777 /etc/containers/ | |
sudo loginctl enable-linger 1000 | |
yarn install | |
podman build -t depthainode-builder --build-arg "NODE_VERSION=v${NODE_VERSION}" . | |
podman run --rm -v .:/app localhost/depthainode-builder:latest | |
env: | |
CI: true | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: prebuilds-${{ matrix.runner }} | |
path: prebuilds/*.node | |
publish: | |
runs-on: buildjet-2vcpu-ubuntu-2204 | |
needs: ["build"] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: "https://npm.pkg.github.com/" | |
scope: "@luxonis" | |
- uses: actions/download-artifact@v3 | |
with: | |
path: all-prebuilds | |
- name: Publish | |
run: | | |
echo "Prepared prebuilds..." | |
npm install | |
npm run relocate-prebuilds | |
echo "Validating..." | |
npm install | |
npm run test | |
echo "Publishing..." | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |