Skip to content

Commit 3da8f2d

Browse files
committedMar 27, 2020
Create github action for builds
1 parent 660b178 commit 3da8f2d

File tree

4 files changed

+70
-38
lines changed

4 files changed

+70
-38
lines changed
 

‎.github/workflows/main.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: main
2+
on: [push, pull_request]
3+
4+
jobs:
5+
ci:
6+
runs-on: ${{ matrix.os }}
7+
env:
8+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-18.04, macos-10.15, windows-2019]
12+
steps:
13+
- uses: actions/checkout@master
14+
- uses: actions/setup-node@master
15+
with:
16+
node-version: "10.19.0"
17+
- run: npm ci
18+
- run: npm run build
19+
- run: npm run tslint
20+
- run: npm run test
21+
- run: npm run publish-coverage
22+
npm-release:
23+
#only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release)
24+
if: startsWith(github.ref, 'refs/tags/v')
25+
needs: ci
26+
runs-on: ubuntu-18.04
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
steps:
31+
- uses: actions/checkout@master
32+
- uses: actions/setup-node@master
33+
with:
34+
node-version: "10.19.0"
35+
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ./.npmrc
36+
- run: npm ci
37+
- run: npm run build
38+
39+
#create npm package
40+
- run: npm package
41+
42+
#compute release version
43+
- name: Compute release version
44+
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF##*/v}
45+
46+
#create GitHub release
47+
- name: Create GitHub Release
48+
id: create_release
49+
uses: actions/create-release@latest
50+
with:
51+
tag_name: ${{ github.ref }}
52+
release_name: ${{ github.ref }}
53+
draft: false
54+
prerelease: false #contains(github.ref, '-beta.') == true
55+
56+
#upload package to GitHub release
57+
- name: Upload vsix to GitHub release
58+
uses: AButler/upload-release-assets@v2.0
59+
with:
60+
files: '*.tgz'
61+
repo-token: ${{ secrets.GITHUB_TOKEN }}
62+
release-tag: v${{ env.RELEASE_VERSION }}
63+
64+
#upload to npm
65+
- run: npm publish

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ coverage
99
.nyc_output
1010
*.zip
1111
graph.svg
12-
.history
12+
.history
13+
*.tgz

‎.travis.yml

-34
This file was deleted.

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"watch": "rimraf out && tsc --watch",
99
"prepublishOnly": "npm run build",
1010
"tslint": "tslint -p tsconfig.json -c tslint.json",
11-
"test": "ts-mocha \"src/**/*.spec.ts\" --full-trace",
12-
"test:coverage": "nyc mocha \"src/**/*.spec.ts\" --full-trace",
11+
"test": "nyc mocha \"src/**/*.spec.ts\" --full-trace",
12+
"test:nocover": "ts-mocha \"src/**/*.spec.ts\" --full-trace",
1313
"test:watch": "ts-mocha \"src/**/*.spec.ts\" --full-trace --watch --watch-extensions ts",
14-
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
14+
"publish-coverage": "nyc report --reporter=text-lcov | coveralls",
1515
"dep-graph": "madge --image graph.svg --extensions ts ./src/parser"
1616
},
1717
"files": [

0 commit comments

Comments
 (0)
Please sign in to comment.