build: Setup Actions (#47)
This commit is contained in:
Родитель
797d31fa78
Коммит
d148cfed85
|
@ -0,0 +1,46 @@
|
||||||
|
workflow "Update data sources" {
|
||||||
|
resolves = ["Fetch latest data sources"]
|
||||||
|
on = "schedule(15 09 * * *)"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Fetch latest data sources" {
|
||||||
|
uses = "actions/npm@master"
|
||||||
|
args = "run update-data-sources"
|
||||||
|
secrets = ["GH_TOKEN"]
|
||||||
|
}
|
||||||
|
|
||||||
|
workflow "Test and publish" {
|
||||||
|
on = "push"
|
||||||
|
resolves = ["Publish via semantic-release", "Upload Algolia Indices"]
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Install dependencies" {
|
||||||
|
uses = "actions/npm@master"
|
||||||
|
args = "ci"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Run tests" {
|
||||||
|
uses = "actions/npm@master"
|
||||||
|
needs = ["Install dependencies"]
|
||||||
|
args = "test"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Only publish master branch" {
|
||||||
|
uses = "actions/bin/filter@master"
|
||||||
|
needs = ["Run tests"]
|
||||||
|
args = "branch master"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Publish via semantic-release" {
|
||||||
|
uses = "actions/npm@master"
|
||||||
|
needs = ["Only publish master branch"]
|
||||||
|
args = "run semantic-release"
|
||||||
|
secrets = ["GH_TOKEN", "NPM_TOKEN"]
|
||||||
|
}
|
||||||
|
|
||||||
|
action "Upload Algolia Indices" {
|
||||||
|
uses = "actions/npm@master"
|
||||||
|
needs = ["Only publish master branch"]
|
||||||
|
args = "run upload"
|
||||||
|
secrets = ["ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_ID"]
|
||||||
|
}
|
13
.travis.yml
13
.travis.yml
|
@ -1,13 +0,0 @@
|
||||||
language: node_js
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- ~/.npm
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
node_js:
|
|
||||||
- '10'
|
|
||||||
after_success:
|
|
||||||
- npm run travis-deploy-once "npm run semantic-release"
|
|
||||||
branches:
|
|
||||||
except:
|
|
||||||
- /^v\d+\.\d+\.\d+$/
|
|
|
@ -10,7 +10,7 @@
|
||||||
"build": "node script/build.js",
|
"build": "node script/build.js",
|
||||||
"preupload": "npm run test",
|
"preupload": "npm run test",
|
||||||
"upload": "node script/upload.js",
|
"upload": "node script/upload.js",
|
||||||
"update": "script/update.sh",
|
"update-data-sources": "script/update-data-sources.sh",
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"test": "tape test.js | tap-summary --no-progress && standard --fix",
|
"test": "tape test.js | tap-summary --no-progress && standard --fix",
|
||||||
"lint": "standard --fix",
|
"lint": "standard --fix",
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -v # print commands before execution, but don't expand env vars in output
|
||||||
|
set -o errexit # always exit on error
|
||||||
|
set -o pipefail # honor exit codes when piping
|
||||||
|
set -o nounset # fail on unset variables
|
||||||
|
|
||||||
|
# bootstrap
|
||||||
|
git clone "https://electron-bot:$GH_TOKEN@github.com/electron/algolia-indices" module
|
||||||
|
cd module
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
# update stuff
|
||||||
|
npm update electron-apps
|
||||||
|
npm update electron-i18n
|
||||||
|
npm update electron-npm-packages
|
||||||
|
npm update electron-releases
|
||||||
|
|
||||||
|
npm run build
|
||||||
|
npm test
|
||||||
|
|
||||||
|
# bail if nothing changed
|
||||||
|
if [ "$(git status --porcelain)" = "" ]; then
|
||||||
|
echo "no new content found; goodbye!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# save changes in git
|
||||||
|
git config user.email electron@github.com
|
||||||
|
git config user.name electron-bot
|
||||||
|
git add .
|
||||||
|
git commit -am "feat: update data sources (auto-roll 🤖)"
|
||||||
|
git pull --rebase && git push origin master --follow-tags
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -x # print commands before execution
|
|
||||||
set -o errexit # always exit on error
|
|
||||||
set -o pipefail # honor exit codes when piping
|
|
||||||
set -o nounset # fail on unset variables
|
|
||||||
|
|
||||||
# bootstrap
|
|
||||||
git clone "https://github.com/electron/algolia-search-index" project
|
|
||||||
cd project
|
|
||||||
npm install
|
|
||||||
|
|
||||||
# update stuff
|
|
||||||
npm update electron-apps
|
|
||||||
npm update electron-i18n
|
|
||||||
npm update electron-npm-packages
|
|
||||||
|
|
||||||
# bail if nothing changed
|
|
||||||
[[ `git status --porcelain` ]] || exit
|
|
||||||
|
|
||||||
# upload to algolia
|
|
||||||
npm run upload
|
|
||||||
|
|
||||||
# save changes in git
|
|
||||||
git add .
|
|
||||||
git config user.email electron@github.com
|
|
||||||
git config user.name electron-bot
|
|
||||||
git commit -am "update data sources"
|
|
||||||
git push origin master --follow-tags
|
|
Загрузка…
Ссылка в новой задаче