-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Create module/index.js that will be used for running the package - Make the node addon file have the OS name tagged on the end - Update README.md - Update bindings for newer version of nodejs - Create release CI to create release and upload tarball file to github - Also publishes to the npm regsitry
- Loading branch information
Showing
15 changed files
with
535 additions
and
713 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
--- | ||
name: Automatic Release | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
env: | ||
export_cmd: | | ||
GIT_TAG=$(echo ${GITHUB_REF#refs/*/} | cut -d 'v' -f 2) | ||
PKG_VERSION=$(echo $(node -p "JSON.stringify(require('./package.json').version)") | sed 's|"||g') | ||
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV | ||
echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [macos-11, ubuntu-20.04] | ||
name: Build ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2.3.5 | ||
- name: Setup Node | ||
uses: actions/setup-node@v1.4.6 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Export git tag and package.json version | ||
run: ${{ env.export_cmd }} | ||
|
||
- name: Check if git tag matches package version | ||
run: if [[ ${{env.GIT_TAG}} != ${{env.PKG_VERSION}} ]]; then exit 1; else exit 0; fi | ||
shell: bash | ||
|
||
- name: Create addon file | ||
run: npm ci | ||
|
||
- name: Export addon file name | ||
run: | | ||
NODE_FILE="" | ||
if [[ ${{ matrix.os }} == *"macos"* ]]; then | ||
NODE_FILE="omega_edit_darwin.node" | ||
mv module/omega_edit_mac.node module/$NODE_FILE | ||
else | ||
NODE_FILE="omega_edit_linux.node" | ||
fi | ||
echo "NODE_FILE=$(echo $NODE_FILE)" >> $GITHUB_ENV | ||
- name: Upload ${{ env.NODE_FILE }} | ||
uses: actions/upload-artifact@v2.3.1 | ||
with: | ||
name: ${{ env.NODE_FILE }} | ||
path: module/${{ env.NODE_FILE }} | ||
release: | ||
name: Release package | ||
runs-on: ubuntu-20.04 | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v2.3.5 | ||
- name: Setup Node | ||
uses: actions/setup-node@v1.4.6 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: 12 | ||
|
||
- name: Export git tag and package.json version | ||
run: ${{ env.export_cmd }} | ||
|
||
- name: Download node files | ||
uses: actions/download-artifact@v2.1.0 | ||
with: | ||
path: module/ | ||
|
||
- name: Move out node files | ||
run: | | ||
cd module | ||
mv omega_edit_linux.node omega_edit_linux.node_dir | ||
mv omega_edit_darwin.node omega_edit_darwin.node_dir | ||
mv omega_edit_linux.node_dir/omega_edit_linux.node . | ||
mv omega_edit_darwin.node_dir/omega_edit_darwin.node . | ||
rm -rf omega_edit_linux.node_dir omega_edit_darwin.node_dir | ||
- name: Check if pre-release | ||
run: | | ||
if [[ ${{env.GIT_TAG}} == *"pre-"* || ${{env.GIT_TAG}} == *"-pre"* ]]; then | ||
echo "PRE_RELEASE=true" >> $GITHUB_ENV | ||
else | ||
echo "PRE_RELEASE=false" >> $GITHUB_ENV | ||
fi | ||
shell: bash | ||
|
||
- name: Create release | ||
uses: actions/create-release@v1.1.4 | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: "${{ env.PRE_RELEASE }}" | ||
|
||
- name: Create release tarball | ||
run: yarn pack --filename omega-edit-v${{ env.PKG_VERSION }}.tar.gz | ||
|
||
- name: Upload release tarball | ||
uses: actions/upload-release-asset@v1.0.2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./omega-edit-v${{ env.PKG_VERSION }}.tar.gz | ||
asset_name: omega-edit-v${{ env.PKG_VERSION }}.tar.gz | ||
asset_content_type: application/tar+gzip | ||
|
||
- name: Publish package to npm registry | ||
run: yarn publish omega-edit-v${{ env.PKG_VERSION }}.tar.gz | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,10 @@ venv/ | |
|
||
# IDE files | ||
.idea/ | ||
|
||
# Ignore addon files | ||
**/*.node | ||
|
||
# Ignore packaged files | ||
**/*.tar.gz | ||
**/*.tgz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
!LICENSE.txt | ||
!package.json | ||
!README.md | ||
!build/Release/omega_edit.node | ||
!module/* |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/********************************************************************************************************************** | ||
* Copyright (c) 2021 Concurrent Technologies Corporation. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * | ||
* with the License. You may obtain a copy of the License at * | ||
* * | ||
* http://www.apache.org/licenses/LICENSE-2.0 * | ||
* * | ||
* Unless required by applicable law or agreed to in writing, software is distributed under the License is * | ||
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * | ||
* implied. See the License for the specific language governing permissions and limitations under the License. * | ||
* * | ||
**********************************************************************************************************************/ | ||
|
||
// Export module for operating system | ||
omega_edit = require("./omega_edit_" + process.platform) | ||
module.exports = omega_edit |
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
Oops, something went wrong.