This repository has been archived by the owner on Feb 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first version of github upload script
- Loading branch information
Showing
3 changed files
with
42 additions
and
8 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 |
---|---|---|
|
@@ -5,11 +5,11 @@ node_js: | |
- stable | ||
|
||
env: | ||
global: | ||
- secure: lkTGpgQdeg5mBji8hg1ZpKO3eO4P0KNgy/VUY3o9WK9poKp+x8Hg72lwRsk2UYxeIUBzxJvSk0FFleeyKnEfH2o6nzvFqseUl+6WlOfFW2lVrDQD7gpT8uk73j6UNVT/oqh3mPO+Hw3c/AnFX7BtLaJJqjn684Twu/uX3wlP2T5dQVIdkHYWW4uxK1qvrGDHux3xDUrDMg+mO4GQKMqiPFlWUGcZHrZNwzMgkbFfhnPbV7W1BPtzPXWfOgVf++hy2wSEWJ3yxcGGC859VioBIgpxXZ6yYIzMto6HmgqL3OaH0jth5Ub5G3GOK1w5y0KmFT4p6wbFDhqm59hCXBxZ8cdD+YH6eEInvhwFbqaI2R1TFtJQCH6eAz3biGvq+vmkRSgwqmOI90F4gUha16xYvGIhDq27j1mVc/BrMtFAAOaa3R74HRHd0Y81FqcCPG2Og6qessns5nPJtSen6vvd9ZJVftRsMUhnOO8AovOZIodm0uP9iDNe3gwpWyXn0YUyXloXeZooXp+Fr6QhvzPcE70K2iwLkzudYhnC1e+s1eOVmPf40zB/vpCUAcuzf9CMxfq7fx1ALcAE8D+Fk2kW/kBZycBlT2KwK5VzpfeplbnuOASRjtlER/u/tDDzJoF/qgbSgQtO+kHWCZ1rImoYI9I4r2dOA8pk8CmUZW65BE8= | ||
- GIT_NAME: Travis CI | ||
- GIT_EMAIL: [email protected] | ||
- GITHUB_REPO: FountainJS/fountain | ||
global: | ||
- secure: lkTGpgQdeg5mBji8hg1ZpKO3eO4P0KNgy/VUY3o9WK9poKp+x8Hg72lwRsk2UYxeIUBzxJvSk0FFleeyKnEfH2o6nzvFqseUl+6WlOfFW2lVrDQD7gpT8uk73j6UNVT/oqh3mPO+Hw3c/AnFX7BtLaJJqjn684Twu/uX3wlP2T5dQVIdkHYWW4uxK1qvrGDHux3xDUrDMg+mO4GQKMqiPFlWUGcZHrZNwzMgkbFfhnPbV7W1BPtzPXWfOgVf++hy2wSEWJ3yxcGGC859VioBIgpxXZ6yYIzMto6HmgqL3OaH0jth5Ub5G3GOK1w5y0KmFT4p6wbFDhqm59hCXBxZ8cdD+YH6eEInvhwFbqaI2R1TFtJQCH6eAz3biGvq+vmkRSgwqmOI90F4gUha16xYvGIhDq27j1mVc/BrMtFAAOaa3R74HRHd0Y81FqcCPG2Og6qessns5nPJtSen6vvd9ZJVftRsMUhnOO8AovOZIodm0uP9iDNe3gwpWyXn0YUyXloXeZooXp+Fr6QhvzPcE70K2iwLkzudYhnC1e+s1eOVmPf40zB/vpCUAcuzf9CMxfq7fx1ALcAE8D+Fk2kW/kBZycBlT2KwK5VzpfeplbnuOASRjtlER/u/tDDzJoF/qgbSgQtO+kHWCZ1rImoYI9I4r2dOA8pk8CmUZW65BE8= | ||
- GIT_NAME: Travis CI | ||
- GIT_EMAIL: [email protected] | ||
- GITHUB_REPO: FountainJS/fountain | ||
|
||
# Deactive fetch submodules by Travis. (e.g. before_script) | ||
git: | ||
|
@@ -75,5 +75,4 @@ before_cache: | |
|
||
after_success: | ||
- echo $TRAVIS_TAG | ||
- if [ ! -z "$TRAVIS_TAG" ]; then echo $TRAVIS_TAG; fi | ||
- if [ ! -z "$TRAVIS_TAG" ] && [[ ${TRAVIS_JOB_NUMBER} == *".1" ]]; then node ./scripts/dist; node ./scripts/upload; fi |
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
console.log('upload script'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const co = require('co'); | ||
const fetch = require('node-fetch'); | ||
const FormData = require('form-data'); | ||
|
||
console.log('env GIT_NAME', process.env.GIT_NAME); | ||
const combinations = require('./helpers/combinations'); | ||
|
||
try { | ||
co(function *() { | ||
for (const options of combinations.full()) { | ||
const fileName = `${options.framework}-${options.modules}-${options.js}-${options.css}-${options.router}-${options.sample}.zip`; | ||
const combinationPath = path.join(__dirname, `../dist/${fileName}`); | ||
|
||
const form = new FormData(); | ||
form.append('name', fileName); | ||
form.append(fileName, fs.createReadStream(combinationPath), { | ||
headers: { | ||
'Authorization': process.env.GITHUB_TOKEN, | ||
'Content-Type': 'application/zip' | ||
} | ||
}); | ||
|
||
const url = `https://github.com/repos/FountainJS/fountain/releases/${process.env.TRAVIS_TAG}/assets`; | ||
|
||
console.log('Uploading', fileName, 'to', url); | ||
|
||
yield fetch(url, { | ||
method: 'POST', | ||
body: form, | ||
headers: form.getHeaders() | ||
}); | ||
} | ||
}); | ||
} catch (error) { | ||
console.log('Something went wrong', error); | ||
} |