Skip to content

Commit

Permalink
chore: publish native libs using GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Oct 19, 2020
1 parent 7b3fd70 commit 257d1b3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ jobs:
- name: Install LLVM
run: choco install -y llvm
if: runner.os == 'Windows'
- run: npm install node-pre-gyp node-pre-gyp-github
- run: npm install
- run: npm run build:v3
- if: runner.os != 'windows'
run: rm -rf native/target
- if: runner.os == 'windows'
run: Remove-Item 'native\target' -Recurse -Force
- run: npm run upload-binary
- run: npm package
- id: set_package_info
run: echo "::set-output name=packageJson::$(npx node-pre-gyp reveal)"
- name: Upload Release Assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.ReleaseDeployKey }}
GITHUB_TOKEN: ${{ secrets.ReleaseDeployKey }}
with:
upload_url: ${{ fromJson(steps.set_package_info.outputs.packageJson).hosted_path }}
asset_path: ${{ fromJson(steps.set_package_info.outputs.packageJson).staged_tarball }}
asset_name: ${{ fromJson(steps.set_package_info.outputs.packageJson).package_name }}
asset_content_type: application/gzip
16 changes: 13 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ jobs:
- name: Install LLVM
run: choco install -y llvm
if: runner.os == 'Windows'
- run: npm install node-pre-gyp node-pre-gyp-github
- run: npm install
- run: npm run build:v3
- if: runner.os != 'windows'
run: rm -rf native/target
- if: runner.os == 'windows'
run: Remove-Item 'native\target' -Recurse -Force
- run: npm run upload-binary
- run: npm package
- id: set_package_info
run: echo "::set-output name=packageJson::$(npx node-pre-gyp reveal)"
- name: Upload Release Assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.ReleaseDeployKey }}
GITHUB_TOKEN: ${{ secrets.ReleaseDeployKey }}
with:
upload_url: ${{ fromJson(steps.set_package_info.outputs.packageJson).hosted_path }}
asset_path: ${{ fromJson(steps.set_package_info.outputs.packageJson).staged_tarball }}
asset_name: ${{ fromJson(steps.set_package_info.outputs.packageJson).package_name }}
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pacts/
# Rust/neon output
pact-foundation-pact-*.tgz
/native/index.node
/native/index.node.sha256
/native/target/
build/
native/artifacts.json

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"appveyor": "./scripts/build.ps1",
"webpack": "webpack --config ./config/webpack.web.config.js",
"postinstall": "node-pre-gyp install --fallback-to-build=false || neon build --release",
"package": "node-pre-gyp package",
"calc-sha256": "node ./scripts/calc-sha256.js"
"package": "npm run native:sha256 && node-pre-gyp package && node-pre-gyp testpackage",
"native:sha256": "node ./scripts/calc-sha256.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -175,7 +175,7 @@
"module_name": "index",
"host": "https://github.com/pact-foundation/pact-js/releases/download/",
"remote_path": "v{version}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"package_name": "{node_abi}-{platform}-{arch}-{libc}.tar.gz",
"module_path": "./native",
"pkg_path": "."
}
Expand Down

0 comments on commit 257d1b3

Please sign in to comment.