This commit is contained in:
Vlad Hashimoto 2019-05-29 02:03:50 +02:00 коммит произвёл GitHub
Родитель 797d31fa78
Коммит d148cfed85
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 80 добавлений и 43 удалений

46
.github/main.workflow поставляемый Normal file
Просмотреть файл

@ -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"]
}

Просмотреть файл

@ -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",

33
script/update-data-sources.sh Executable file
Просмотреть файл

@ -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