mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
141 lines
4.3 KiB
YAML
141 lines
4.3 KiB
YAML
name: 'node.js'
|
|
on:
|
|
pull_request:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
|
|
jobs:
|
|
prebuild:
|
|
name: 'Prebuild'
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-18.04, macos-latest, windows-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
- name: System info
|
|
run: |
|
|
rustc -vV
|
|
rustup -vV
|
|
cargo -vV
|
|
npm --version
|
|
node --version
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
${{ env.APPDATA }}/npm-cache
|
|
~/.npm
|
|
key: ${{ matrix.os }}-node-${{ hashFiles('**/package.json') }}
|
|
|
|
- name: Cache cargo index
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ matrix.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
|
|
|
|
- name: Install dependencies & build
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd node
|
|
npm install --verbose
|
|
|
|
- name: Build Prebuild
|
|
run: |
|
|
cd node
|
|
npm run prebuildify
|
|
tar -zcvf "${{ matrix.os }}.tar.gz" -C prebuilds .
|
|
|
|
- name: Upload Prebuild
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: ${{ matrix.os }}
|
|
path: node/${{ matrix.os }}.tar.gz
|
|
|
|
pack-module:
|
|
needs: prebuild
|
|
name: 'Package deltachat-node and upload to download.delta.chat'
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: install tree
|
|
run: sudo apt install tree
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
- name: System info
|
|
run: |
|
|
rustc -vV
|
|
rustup -vV
|
|
cargo -vV
|
|
npm --version
|
|
node --version
|
|
- name: Download ubuntu prebuild
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: ubuntu-18.04
|
|
- name: Download macos prebuild
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: macos-latest
|
|
- name: Download windows prebuild
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: windows-latest
|
|
- shell: bash
|
|
run: |
|
|
mkdir node/prebuilds
|
|
tar -xvzf ubuntu-18.04/ubuntu-18.04.tar.gz -C node/prebuilds
|
|
tar -xvzf macos-latest/macos-latest.tar.gz -C node/prebuilds
|
|
tar -xvzf windows-latest/windows-latest.tar.gz -C node/prebuilds
|
|
tree node/prebuilds
|
|
- name: install dependencies without running scripts
|
|
run: |
|
|
npm install --ignore-scripts
|
|
- name: build typescript part
|
|
run: |
|
|
npm run build:bindings:ts
|
|
- name: Set DELTACHAT_NODE_TAR_GZ env variable
|
|
run: |
|
|
echo "DELTACHAT_NODE_TAR_GZ=deltachat-node-${{ github.ref_name }}" >> $GITHUB_ENV
|
|
- name: package
|
|
shell: bash
|
|
run: |
|
|
npm pack .
|
|
ls -lah
|
|
mv $(find deltachat-node-*) $DELTACHAT_NODE_TAR_GZ
|
|
- name: Upload Prebuild
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: deltachat-node.tgz
|
|
path: $DELTACHAT_NODE_TAR_GZ
|
|
# Upload to download.delta.chat/node/preview/
|
|
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
|
|
id: upload-preview
|
|
shell: bash
|
|
run: |
|
|
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
|
chmod 600 __TEMP_INPUT_KEY_FILE
|
|
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
|
|
continue-on-error: true
|
|
# Upload to download.delta.chat/node/
|
|
- name: Upload deltachat-node build to download.delta.chat/node/
|
|
if: ${{ steps.tag.outputs.tag }}
|
|
id: upload
|
|
shell: bash
|
|
run: |
|
|
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
|
chmod 600 __TEMP_INPUT_KEY_FILE
|
|
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"
|