1.0.0 • Published 6 years ago
@gr2m/release-asset-upload v1.0.0
octokit-release-asset-upload
Upload files to a GitHub Release from Node and the browser
⚠️ currently not working in browser
See #1 for more information.
⚠️ uploading with {replace: true} fails
See #2 for more information.
Usage
See options below. The octokitReleaseAssetUpload
method resolves
with the response from the GitHub API
and an additional .release
property which is the release response.
See list of potential errors below.
As Node module
// npm install @gr2m/release-asset-upload
const octokitReleaseAssetUpload = require('@gr2m/release-asset-upload')
const fs = require('fs')
octokitReleaseAssetUpload({
owner: 'octokit-fixture-org',
repo: 'release-assets',
tag: 'v1.0.0',
username: 'your-username',
password: 'secret'
file: fs.createReadStream('example.png'),
name: 'example.png',
contentType: 'image/png',
contentLength: fs.statSync('example.png').size
})
In Browser
<input type="file" id="input">
<script src="octokit-release-asset-upload.min.js"></script>
<script>
octokitReleaseAssetUpload({
owner: 'octokit-fixture-org',
repo: 'release-assets',
tag: 'v1.0.0',
username: 'your-username',
password: 'secret'
file: document.getElementById('input').files[0]
})
</script>
CLI
$ npx octokit-release-asset-upload \
https://github.com/gr2m/octokit-release-asset-upload/releases/tag/v1.0.0 \
./example.png \
--username="your-username" \
--password="secret" \
Options
Errors
Similar solutions
- https://github.com/hypermodules/gh-release-assets – Upload assets to a GitHub release
- https://github.com/remixz/publish-release – Create GitHub releases with assets from CLI
- https://github.com/coderaiser/node-putasset – upload asset to release on github
- https://github.com/juliangruber/gh-release-upload – CLI to upload an asset to the latest GitHub Release.
Contribute
All contributions are welcome ❤️ See CONTRIBUTING.md for more details
LICENSE
1.0.0
6 years ago