Skip to content

Commit 16a2f45

Browse files
Merge pull request #76 from grammarly/f-github-actions
Run tests with github actions
2 parents 77fe119 + f6f5c69 commit 16a2f45

File tree

6 files changed

+79
-28
lines changed

6 files changed

+79
-28
lines changed

.github/workflows/Readme.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CI powered by GitHub Actions
2+
3+
## Release
4+
5+
For each tag `v*` that is pushed into `master` branch CI creates ["Release"](https://github.com/grammarly/focal/releases) and attaches package tarball `grammarly-focal-v*.tgz`. For details see `release.yml`
6+
7+
## Tests
8+
9+
For each push into pull_reusets CI runs tests. Check `tests.yml` for details.

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
release:
10+
# There is no way to run a workflow on push tags on a specific branch.
11+
# The job should be skipped when running for a non-master branch.
12+
if: github.event.base_ref == 'refs/heads/master'
13+
name: Release (skip on non-main branch)
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Branch name
17+
id: branch_name
18+
run: |
19+
echo ::set-output name=TARBALL::grammarly-focal-${GITHUB_REF#refs/tags/}.tgz
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
- run: yarn install
23+
- run: yarn build
24+
- run: yarn test
25+
- run: yarn package
26+
- name: Create Release
27+
id: create_release
28+
uses: actions/create-release@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
tag_name: ${{ github.ref }}
33+
release_name: ${{ github.ref }}
34+
draft: false
35+
prerelease: false
36+
- name: Upload Release Asset
37+
id: upload-release-asset
38+
uses: actions/upload-release-asset@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
43+
asset_path: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }}
44+
asset_name: ${{ steps.branch_name.outputs.TARBALL }}
45+
asset_content_type: application/zip

.github/workflows/tests.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
tests:
7+
name: Run tests
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [12.x]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: yarn install
21+
- run: yarn build
22+
- run: yarn test
23+
env:
24+
CI: true

.travis.yml

-25
This file was deleted.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"scripts": {
55
"build": "yarn workspace @grammarly/focal build",
66
"package": "yarn workspace @grammarly/focal pack",
7-
"release": "yarn workspace @grammarly/focal release",
87
"test": "yarn workspace @grammarly/focal test && yarn workspace focal-todomvc build && yarn workspace focal-examples build && yarn workspace focal-manual-tests build",
98
"postinstall": "yarn build"
109
},

packages/focal/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"prepack": "cp ../../README.md ./ && cp ../../LICENSE ./",
3030
"postpack": "rm README.md && rm LICENSE",
3131
"preversion": "if ! [[ $(git rev-parse --abbrev-ref HEAD) == \"master\" ]]; then echo \"Not on the master branch.\" && exit 1; fi",
32-
"postversion": "git push && git push --tags",
33-
"release": "echo Publishing v${VER:?\"Usage: VER=1.2.3 npm run release\"}... && npm publish https://github.com/grammarly/focal/releases/download/v$VER/grammarly-focal-v$VER.tgz --access public"
32+
"postversion": "git push && git push --tags"
3433
},
3534
"author": "Sergey Yavnyi <[email protected]>",
3635
"contributors": [

0 commit comments

Comments
 (0)