Skip to content

Commit

Permalink
build: Added GitHub action to publish to npm
Browse files Browse the repository at this point in the history
chore: Cleaned up readme and updated deps
  • Loading branch information
cb1kenobi authored and ewanharris committed Mar 20, 2022
1 parent 8edb17a commit fa1c39e
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 375 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
name: Build
on: [push, pull_request]
on:
- push
- pull_request

jobs:
build:
runs-on: macos-latest
name: Build

steps:
- uses: actions/checkout@v2

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12'
- run: yarn install --frozen-lockfile
name: Build
node-version: '16'

- name: Build
run: yarn install --frozen-lockfile

- name: Archive pre-built bindings
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: binding
path: binding/**
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish
on:
release:
types: [ created ]

jobs:
publish:
runs-on: macos-latest
name: Publish

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Build
run: yarn install --frozen-lockfile

- name: Archive pre-built bindings
uses: actions/upload-artifact@v3
with:
name: binding
path: binding/**

- name: Publish to npm
env:
GH_TOKEN: ${{ github.token }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish
5 changes: 1 addition & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
._*
.DS_Store
.git
.git*
.gitignore
.travis.yml
*.tgz
binding
/build
/node_modules
/out
npm-debug.log*
env.properties
/Jenkinsfile
yarn.lock
/bin/publish.js
12 changes: 0 additions & 12 deletions Jenkinsfile

This file was deleted.

16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# node-ios-device [![Build Status](https://travis-ci.org/appcelerator/node-ios-device.svg?branch=master)](https://travis-ci.org/appcelerator/node-ios-device) [![Greenkeeper badge](https://badges.greenkeeper.io/appcelerator/node-ios-device.svg)](https://greenkeeper.io/)
# node-ios-device

Queries connected iOS devices, installs apps, and relays log output.

Expand All @@ -16,8 +16,8 @@ node-ios-device is currently compatible with the following versions:
* 16.x (module API v93)
* 17.x (module API v102)

Only Mac OS X (darwin) is supported. You should make this module an optional
dependency of your application and it will only be downloaded on OS X.
Only macOS (darwin) is supported. You should make this module an optional
dependency of your application and it will only be downloaded on macOS.

> Note: [email protected] will only support Node.js 4 and newer.
Expand Down Expand Up @@ -280,14 +280,6 @@ To debug `node-ios-device`,
- Add the environment variable `DEBUG=*`
- Close out the schemes and click "Run"

### Publishing

This section is intended for Appcelerator release managers.

To publish a new release to NPM, run `npm publish`. This will build
`node-ios-device` for all Node.js module API versions and then upload each
binary to the associated release on the GitHub repository.

## License

This project is open source and provided under the Apache Public License
Expand All @@ -298,5 +290,3 @@ privacy notice at the end of the file.
This project contains `mobiledevice.h` from
[https://bitbucket.org/tristero/mobiledeviceaccess](https://bitbucket.org/tristero/mobiledeviceaccess)
and is available under public domain.

#### (C) Copyright 2012-2018, [Appcelerator](http://www.appcelerator.com/) Inc. All Rights Reserved.
8 changes: 3 additions & 5 deletions bin/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ async function main() {
const githubToken = process.env.GH_TOKEN;
if (!githubToken) {
throw new Error('Publishing requires the environment variable GH_TOKEN to be set!');
}
}

const github = new Octokit({
auth: `token ${githubToken}`
});
const packageJSON = require('../package.json');
// TODO: Parse the owner/repo from packageJSON.repository.url
const owner = 'appcelerator';
const repo = 'node-ios-device';
const [ gitUrl, owner, repo ] = packageJSON.repository.url.match(/github\.com\/([^\/]+)\/(.+(?=.git)+)/);

const release = {
owner,
Expand Down Expand Up @@ -75,7 +73,7 @@ async function main() {
} = await github.repos.uploadReleaseAsset(upload);
console.log('Published file', downloadUrl);
updated.push(filePath);
} catch (err) {
} catch (err) {
if (err.errors && err.errors[0].code === 'already_exists') {
console.warn(`Did not publish ${filePath} as it already exists`);
} else {
Expand Down
41 changes: 16 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,15 @@
"name": "node-ios-device",
"description": "Simple library for listing and installing apps on iOS devices",
"version": "1.9.3",
"author": {
"name": "Appcelerator, Inc.",
"email": "[email protected]"
},
"author": "TiDev, Inc. <[email protected]>",
"maintainers": [
{
"name": "Chris Barber",
"email": "[email protected]"
}
"Chris Barber <[email protected]>"
],
"repository": {
"type": "git",
"url": "git://github.com/appcelerator/node-ios-device.git"
"url": "git://github.com/tidev/node-ios-device.git"
},
"keywords": [
"appcelerator",
"ios",
"iphone",
"ipad",
Expand All @@ -27,20 +20,21 @@
"device",
"devices"
],
"license": "Apache-2.0",
"gypfile": true,
"main": "./ios-device",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.6",
"debug": "^4.2.0",
"@mapbox/node-pre-gyp": "^1.0.8",
"debug": "^4.3.4",
"nan": "^2.15.0",
"node-pre-gyp-init": "^1.2.1"
},
"devDependencies": {
"@octokit/rest": "^18.3.5"
"@octokit/rest": "^18.12.0"
},
"scripts": {
"install": "node ./bin/run.js node-pre-gyp install --fallback-to-build",
"build-n-publish-binding": "node ./bin/run.js node-pre-gyp rebuild package publish",
"prepare": "node ./bin/run.js node ./bin/build-all.js",
"package-all": "node ./bin/run.js node ./bin/build-all.js rebuild package",
"rebuild": "node ./bin/run.js node-pre-gyp rebuild",
"rebuild-debug": "node ./bin/run.js node-pre-gyp --debug rebuild",
"xcode": "node ./bin/run.js node-pre-gyp configure -- -f xcode",
Expand All @@ -53,19 +47,16 @@
"remote_path": "./tidev/{name}/releases/download/v{version}",
"host": "https://github.com",
"targets": {
"10.16.3": 64,
"10.24.1": 64,
"11.15.0": 67,
"12.11.0": 72,
"13.5.0": 79,
"14.13.1": 83,
"15.0.1": 88,
"16.0.0": 93,
"17.0.1": 102
"12.22.11": 72,
"13.14.0": 79,
"14.19.1": 83,
"15.14.0": 88,
"16.14.2": 93,
"17.7.2": 102
}
},
"license": "Apache-2.0",
"gypfile": true,
"main": "./ios-device",
"engines": {
"node": ">=10.13"
}
Expand Down
Loading

0 comments on commit fa1c39e

Please sign in to comment.