This repository has been archived by the owner on Jul 25, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: adds github actions
- Loading branch information
Showing
7 changed files
with
1,915 additions
and
1,705 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
workflow "build and test" { | ||
resolves = [ | ||
"lint", | ||
"coverage", | ||
] | ||
on = "push" | ||
} | ||
|
||
action "branch-filter" { | ||
uses = "actions/bin/filter@master" | ||
args = "branch" | ||
} | ||
|
||
action "install" { | ||
needs = ["branch-filter"] | ||
uses = "docker://node:10" | ||
args = "yarn install --frozen-lockfile" | ||
} | ||
|
||
action "build" { | ||
uses = "docker://node:10" | ||
needs = ["install"] | ||
args = "yarn run build" | ||
} | ||
|
||
action "lint" { | ||
uses = "docker://node:10" | ||
needs = ["install"] | ||
args = "yarn run lint" | ||
} | ||
|
||
action "test" { | ||
uses = "docker://node:10" | ||
needs = ["build"] | ||
args = "yarn run test" | ||
} | ||
|
||
action "coverage" { | ||
uses = "docker://node:10" | ||
needs = ["test"] | ||
args = "yarn run coverage" | ||
} | ||
|
||
workflow "release" { | ||
resolves = [ | ||
"github-release", | ||
"release:lint", | ||
] | ||
on = "push" | ||
} | ||
|
||
action "release:tag-filter" { | ||
uses = "actions/bin/filter@master" | ||
args = "tag v*" | ||
} | ||
|
||
action "release:install" { | ||
uses = "docker://node:10" | ||
needs = ["release:tag-filter"] | ||
args = "yarn install --frozen-lockfile" | ||
} | ||
|
||
action "release:build" { | ||
uses = "docker://node:10" | ||
needs = ["release:install"] | ||
args = "yarn run build" | ||
} | ||
|
||
action "release:lint" { | ||
uses = "docker://node:10" | ||
needs = ["release:install"] | ||
args = "yarn run lint" | ||
} | ||
|
||
action "release:test" { | ||
uses = "docker://node:10" | ||
needs = ["release:build"] | ||
args = "yarn run test" | ||
} | ||
|
||
action "release:publish" { | ||
needs = ["release:test"] | ||
uses = "docker://node:10" | ||
args = "sh scripts/publish.sh" | ||
secrets = [ | ||
"REGISTRY_AUTH_TOKEN", | ||
] | ||
env = { | ||
REGISTRY_URL = "registry.npmjs.org" | ||
} | ||
} | ||
|
||
action "github-release" { | ||
needs = ["release:publish"] | ||
uses = "docker://node:10" | ||
args = "sh scripts/github-release.sh" | ||
secrets = [ | ||
"GITHUB_TOKEN", | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Get the last tag from GitHub | ||
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
|
||
changelog=$(git show $GITHUB_SHA --unified=0 CHANGELOG.md | tail +12 | sed -e 's/^\+//') | ||
|
||
echo "$changelog" | ||
|
||
echo "$changelog" | node scripts/trigger-release.js $lastTag |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Get the last tag from GitHub | ||
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
|
||
# Print it to the console for verification | ||
echo "Bumping version to new tag: ${lastTag}" | ||
|
||
# creating .npmrc | ||
echo "//$REGISTRY_URL/:_authToken=$REGISTRY_AUTH_TOKEN" > .npmrc | ||
|
||
# Publish to NPM | ||
npm publish --registry https://$REGISTRY_URL/ |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const [, , /* node */ /* file */ tag] = process.argv; | ||
|
||
const getStdin = require('get-stdin'); | ||
const Octokit = require('@octokit/rest'); | ||
const octokit = new Octokit({ | ||
auth: `token ${process.env.GITHUB_TOKEN}` | ||
}); | ||
|
||
const [repoOwner, repoName] = process.env.GITHUB_REPOSITORY.split('/'); | ||
|
||
getStdin() | ||
.then(changelog => | ||
octokit.repos.createRelease({ | ||
owner: repoOwner, | ||
repo: repoName, | ||
tag_name: tag, | ||
body: changelog, | ||
draft: true | ||
}) | ||
) | ||
.catch(err => { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.