chore: Test and update via Actions (#42)

This commit is contained in:
Michelle Tilley 2019-05-29 11:37:04 -07:00 коммит произвёл GitHub
Родитель 5e30beac5e
Коммит 7d1b77e433
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 47 добавлений и 17 удалений

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

@ -1 +1 @@
GITHUB_AUTH_TOKEN=df09c7ee4a81d0cbfc128201baee5f2da2a3ae94
GH_TOKEN=

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

@ -0,0 +1,29 @@
workflow "Update and release" {
on = "schedule(0 * * * *)"
resolves = ["Update data and release"]
}
action "Update data and release" {
uses = "actions/npm@master"
args = "run release"
secrets = [
"GH_TOKEN",
"NPM_AUTH_TOKEN",
]
}
workflow "Test" {
on = "push"
resolves = ["Run tests"]
}
action "Install dependencies" {
uses = "actions/npm@master"
args = "ci"
}
action "Run tests" {
uses = "actions/npm@master"
needs = ["Install dependencies"]
args = "test"
}

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

@ -1,8 +0,0 @@
language: node_js
node_js:
- '8'
- '10'
install:
- npm ci
script:
- npm run build && npm test

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

@ -1,7 +1,9 @@
#!/usr/bin/env node
require('make-promises-safe')
require('dotenv-safe').load()
if (!process.env.GH_TOKEN) {
require('dotenv-safe').load()
}
const fs = require('fs')
const path = require('path')
@ -18,7 +20,7 @@ const firstNpmVersion = '1.3.1'
github.authenticate({
type: 'token',
token: process.env.GITHUB_AUTH_TOKEN
token: process.env.GH_TOKEN
})
main()

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

@ -1,20 +1,27 @@
#!/usr/bin/env bash
set -x # print commands before execution
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
git clone "https://github.com/electron/electron-releases" module
git clone "https://electron-bot:$GH_TOKEN@github.com/electron/releases" module
cd module
npm install
npm ci
npm run build
npm test
[[ `git status --porcelain` ]] || exit
git add .
# bail if nothing changed
if [ "$(git status --porcelain)" = "" ]; then
echo "no new content found; goodbye!"
exit
fi
git config user.email electron@github.com
git config user.name electron-bot
git add .
git commit -am "update electron-releases"
npm version minor -m "bump minor to %s"
git push origin master --follow-tags
npm publish
npm publish