mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 12:02:18 +02:00
GitHub: add a workflow to publish a tag to NPM
And remove the old copy_repo.sh used to generate libsignal-client-node.
This commit is contained in:
parent
1ccc91ae81
commit
8db505b4f7
104
.github/workflows/npm.yml
vendored
Normal file
104
.github/workflows/npm.yml
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
name: Publish to NPM
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.tag }}
|
||||||
|
|
||||||
|
- name: Install nightly rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
|
||||||
|
- name: Get Node version from .nvmrc
|
||||||
|
id: get-nvm-version
|
||||||
|
shell: bash
|
||||||
|
run: echo "::set-output name=node-version::$(cat .nvmrc)"
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ steps.get-nvm-version.outputs.node-version }}
|
||||||
|
|
||||||
|
- name: Verify that the Node bindings are up to date
|
||||||
|
run: rust/bridge/node/bin/gen_ts_decl.py --verify
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
|
||||||
|
- run: yarn install --ignore-scripts --frozen-lockfile
|
||||||
|
|
||||||
|
- run: npx prebuildify --napi
|
||||||
|
|
||||||
|
- name: Upload library
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: libsignal_client (${{matrix.os}})
|
||||||
|
path: prebuilds/*
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.tag }}
|
||||||
|
|
||||||
|
- name: Get Node version from .nvmrc
|
||||||
|
id: get-nvm-version
|
||||||
|
shell: bash
|
||||||
|
run: echo "::set-output name=node-version::$(cat .nvmrc)"
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ steps.get-nvm-version.outputs.node-version }}
|
||||||
|
|
||||||
|
- name: Download built libraries
|
||||||
|
id: download
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Copy libraries
|
||||||
|
run: mkdir prebuilds && mv ${{ steps.download.outputs.download-path }}/*/* prebuilds && find prebuilds
|
||||||
|
|
||||||
|
- run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- run: yarn tsc
|
||||||
|
|
||||||
|
- run: yarn lint
|
||||||
|
|
||||||
|
- run: yarn format -c
|
||||||
|
|
||||||
|
- name: Run yarn test
|
||||||
|
uses: GabrielBB/xvfb-action@v1.4
|
||||||
|
with:
|
||||||
|
# The tests use an Electron-based runner, so we need to set up a dummy display for them.
|
||||||
|
run: yarn test
|
||||||
|
|
||||||
|
- name: Publish to NPM
|
||||||
|
uses: JS-DevTools/npm-publish@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.NPM_TOKEN }}
|
||||||
|
access: "public"
|
@ -1,41 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2021 Signal Messenger, LLC.
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
#
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
|
||||||
cd "${SCRIPT_DIR}"/../..
|
|
||||||
. bin/build_helpers.sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# copy_repo.sh <source> <destination>
|
|
||||||
#
|
|
||||||
# Copy the given node directory to the artifact repository.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# libsignal-client$ node/scripts/copy_repo.sh ../libsignal-client-node
|
|
||||||
#
|
|
||||||
|
|
||||||
mkdir -p $1
|
|
||||||
|
|
||||||
cp -vf package.json $1
|
|
||||||
cp -vf node/index.ts $1
|
|
||||||
cp -vf node/libsignal_client.d.ts $1
|
|
||||||
|
|
||||||
mkdir -p $1/dist
|
|
||||||
cp -vf node/dist/index.d.ts $1/dist
|
|
||||||
cp -vf node/dist/index.js $1/dist
|
|
||||||
cp -vf node/libsignal_client.d.ts $1/dist
|
|
||||||
|
|
||||||
mkdir -p $1/build
|
|
||||||
cp -vf build/Release/libsignal_client_*.node $1/build
|
|
||||||
|
|
||||||
# Ensure that the LICENSE file is up to date.
|
|
||||||
cp -vf ./LICENSE $1
|
|
||||||
|
|
||||||
# Ensure that the README.md file is up to date.
|
|
||||||
cp -vf ./README.md $1
|
|
Loading…
Reference in New Issue
Block a user