forked from Wireguard/Wireguard-tools.js
129 lines
2.9 KiB
YAML
129 lines
2.9 KiB
YAML
name: Publish
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v1.*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
pkgVersion:
|
|
required: true
|
|
type: string
|
|
description: Package version
|
|
releaseType:
|
|
type: choice
|
|
description: Is pre-release or next stable release
|
|
default: next
|
|
options:
|
|
- latest
|
|
- next
|
|
|
|
jobs:
|
|
linux_build:
|
|
runs-on: ubuntu-latest
|
|
name: Build for Linux
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
name: Checkout
|
|
|
|
- uses: actions/setup-node@v4
|
|
name: Setup Node.js
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
set -ex
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo apt update &> /dev/null
|
|
sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross
|
|
npm install --no-save --ignore-scripts
|
|
|
|
- name: Build addon
|
|
run: npm run prebuildify -- -v
|
|
|
|
- name: Upload prebuilds interface
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
retention-days: 7
|
|
name: prebuilds_${{ runner.os }}
|
|
path: "prebuilds/**"
|
|
|
|
macos_build:
|
|
runs-on: macos-latest
|
|
name: Build for MacOS
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
name: Checkout
|
|
|
|
- uses: actions/setup-node@v4
|
|
name: Setup Node.js
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Install dependencies
|
|
run: npm install --no-save --ignore-scripts
|
|
|
|
- name: Build addon
|
|
run: npm run prebuildify -- -v
|
|
|
|
- name: Upload prebuilds interface
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
retention-days: 7
|
|
name: prebuilds_${{ runner.os }}
|
|
path: "prebuilds/**"
|
|
|
|
win_build:
|
|
runs-on: windows-latest
|
|
name: Build for Windows
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
name: Checkout
|
|
|
|
- uses: actions/setup-node@v4
|
|
name: Setup Node.js
|
|
with:
|
|
node-version: 20.x
|
|
|
|
- name: Install dependencies
|
|
run: npm install --no-save --ignore-scripts
|
|
|
|
- name: Build addon
|
|
run: npm run prebuildify -- -v
|
|
|
|
- name: Upload prebuilds interface
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
retention-days: 7
|
|
name: prebuilds_${{ runner.os }}
|
|
path: "prebuilds/**"
|
|
|
|
publish:
|
|
needs: [ linux_build, macos_build, win_build ]
|
|
runs-on: ubuntu-latest
|
|
name: Publish to npm registry
|
|
permissions:
|
|
id-token: write
|
|
pull-requests: write
|
|
issues: write
|
|
contents: write
|
|
env:
|
|
PACKAGE_VERSION: ${{ github.ref }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
name: Code checkout
|
|
|
|
- uses: actions/setup-node@v4
|
|
name: Setup node.js
|
|
with:
|
|
node-version: 20.x
|
|
registry-url: https://registry.npmjs.org/
|
|
|
|
- name: Download all artefacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: ./prebuilds
|
|
|
|
- name: Edit version and install depencies
|
|
run: |
|
|
sudo npm i -g semver |