Skip to content

Commit da3aa95

Browse files
Added github actions
1 parent cd6a421 commit da3aa95

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed

.github/workflows/build-release.yaml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# https://github.com/actions/upload-release-asset
2+
3+
# This is the command I used to test on a fork of the repo
4+
# git add . && git commit -m a && npm version patch && git push && git push --tags
5+
6+
on:
7+
push:
8+
# Sequence of patterns matched against refs/tags
9+
tags:
10+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
11+
12+
name: Upload Release Asset
13+
14+
jobs:
15+
build:
16+
name: Upload Release Asset
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node-version: [14.15.3]
21+
steps:
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: Checkout code
27+
uses: actions/checkout@v1
28+
- name: Get the file name
29+
id: get_file_name
30+
run: echo ::set-output name=result::rederly-$(git describe)-backend
31+
- name: NPM install
32+
uses: bahmutov/npm-install@v1
33+
- name: Build and package
34+
run: npm run build:package
35+
env:
36+
REDERLY_PACKAGER_DEST_FILE: ${{ steps.get_file_name.outputs.result }}
37+
# Can't preserve packages because try build will find the node module in the parent directory
38+
REDERLY_PACKAGER_PRESERVE_NODE_MODULES: false
39+
CI: false # TODO Linting errors cause the build to fail when CI is true (default)
40+
- name: Try build
41+
run: npm --prefix build run cli:built noop
42+
env:
43+
DB_SYNC: false
44+
FAIL_ON_MISSING_CONFIGURATIONS: false
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
tag_name: ${{ github.ref }}
52+
release_name: Release ${{ github.ref }}
53+
draft: false
54+
prerelease: true
55+
- name: Upload Release Asset (zip)
56+
id: upload-release-asset-zip
57+
uses: actions/upload-release-asset@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
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
62+
asset_path: ./package-outputs/${{ steps.get_file_name.outputs.result }}.zip
63+
asset_name: ${{ steps.get_file_name.outputs.result }}.zip
64+
asset_content_type: application/zip
65+
- name: Upload Release Asset (tgz)
66+
id: upload-release-asset-tgz
67+
uses: actions/upload-release-asset@v1
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
upload_url: ${{ steps.create_release.outputs.upload_url }}
72+
asset_path: ./package-outputs/${{ steps.get_file_name.outputs.result }}.tgz
73+
asset_name: ${{ steps.get_file_name.outputs.result }}.tgz
74+
asset_content_type: application/gzip

.github/workflows/eslint.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: reviewdog
2+
on: [pull_request]
3+
jobs:
4+
eslint:
5+
name: runner / eslint
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v1
9+
- uses: bahmutov/npm-install@v1
10+
- name: eslint
11+
uses: reviewdog/action-eslint@v1
12+
with:
13+
reporter: github-pr-review
14+
level: warning
15+
eslint_flags: '--ext .tsx,.ts,.js .'
16+
fail_on_error: true

.github/workflows/test.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Node.js CI
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [14.15.3]
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v1
17+
- name: NPM install
18+
uses: bahmutov/npm-install@v1
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
# Needs to be before the try build step since it prunes dependencies
24+
- name: Test
25+
run: npm test
26+
env:
27+
CI: true
28+
- name: Build and package
29+
run: npm run build:package
30+
env:
31+
REDERLY_PACKAGER_ARCHIVE: false
32+
# Can't preserve packages because try build will find the node module in the parent directory
33+
REDERLY_PACKAGER_PRESERVE_NODE_MODULES: false
34+
CI: false # TODO Linting errors cause the build to fail when CI is true (default)
35+
- name: Try build
36+
run: npm --prefix build run cli:built noop
37+
env:
38+
DB_SYNC: false
39+
FAIL_ON_MISSING_CONFIGURATIONS: false

0 commit comments

Comments
 (0)