Skip to content

Commit 8c9a96c

Browse files
rakshith-ravithebongysauravhiremath
authored
WIP feat: Add github actions workflow (#5)
* Added github workflows. Needs refinements * fix: Build only cjs style module, juno-node won't run in a browser * fix: Seperate tsconfigs for tests and module * fix: Removed travis config * update: github build config. * fix: removed travis check * WIP: github config * WIP: Assest uploading remains * WIP: Upload release asset CI * fix: build.yml modified * fix: Build Config updated * feat: Updated pr.yml * fix: Race condition handled * feat: npm publish added * feat: added beta npm publish * fix: Run version-check and build in parallel * fix: Tag names * fix: Fetch tags Co-authored-by: thebongy <[email protected]> Co-authored-by: Saurav M. H <[email protected]>
1 parent 8f093ee commit 8c9a96c

File tree

10 files changed

+681
-473
lines changed

10 files changed

+681
-473
lines changed

.github/workflows/build.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
8+
name: Continuous integration
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup nodejs
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: '12.x'
21+
22+
- name: Check Release Version
23+
uses: thebongy/version-check@v1
24+
with:
25+
file: package.json
26+
id: version_check
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Linting and Test
32+
run: npm run test:prod
33+
34+
- name: Run Build
35+
run: npm run build
36+
37+
- name: Create tarball
38+
run: npm pack
39+
40+
- name: Upload Artifact
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: juno-node-${{ steps.version_check.outputs.releaseVersion }}
44+
path: ./juno-node-${{ steps.version_check.outputs.rawVersion }}.tgz
45+
46+
# Publish release on push to master
47+
release-master:
48+
if: github.ref == 'refs/heads/master'
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- uses: actions/checkout@v2
53+
- run: git fetch --all --tags
54+
55+
- name: Check Release Version
56+
id: version_check
57+
uses: thebongy/version-check@v1
58+
with:
59+
file: package.json
60+
tagFormat: v${version}
61+
62+
- name: Publish Release
63+
id: create_release
64+
uses: actions/create-release@latest
65+
with:
66+
tag_name: ${{ steps.version_check.outputs.releaseVersion }}
67+
release_name: juno-node-${{ steps.version_check.outputs.releaseVersion }}
68+
prerelease: false
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Download Artifact
73+
uses: actions/download-artifact@v2
74+
with:
75+
name: juno-node-${{ steps.version_check.outputs.releaseVersion }}
76+
77+
- name: Upload Release Asset
78+
uses: actions/upload-release-asset@v1
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
upload_url: ${{ steps.create_release.outputs.upload_url }}
83+
asset_path: juno-node-${{ steps.version_check.outputs.rawVersion }}.tgz
84+
asset_name: juno-node-${{ steps.version_check.outputs.releaseVersion }}.tgz
85+
asset_content_type: application/tgz
86+
87+
- name: Publish to npm
88+
run: npm publish juno-node-${{ steps.version_check.outputs.rawVersion }}.tgz
89+
env:
90+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
91+
92+
release-staging:
93+
if: github.ref == 'refs/heads/staging'
94+
runs-on: ubuntu-latest
95+
needs: build
96+
steps:
97+
- uses: actions/checkout@v2
98+
- run: git fetch --all --tags
99+
100+
- name: Check Release Version
101+
id: version_check
102+
uses: thebongy/version-check@v1
103+
with:
104+
file: package.json
105+
tagFormat: v${version}-beta
106+
107+
- name: Download Artifact
108+
uses: actions/download-artifact@v2
109+
with:
110+
name: juno-node-${{ steps.version_check.outputs.releaseVersion }}
111+
112+
- name: Publish Release
113+
id: create_release
114+
uses: actions/create-release@latest
115+
with:
116+
tag_name: ${{ steps.version_check.outputs.releaseVersion }}
117+
release_name: juno-node-${{ steps.version_check.outputs.releaseVersion }}
118+
prerelease: true
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Upload Release Asset
123+
uses: actions/upload-release-asset@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
upload_url: ${{ steps.create_release.outputs.upload_url }}
128+
asset_path: juno-node-${{ steps.version_check.outputs.rawVersion }}.tgz
129+
asset_name: juno-node-${{ steps.version_check.outputs.releaseVersion }}.tgz
130+
asset_content_type: application/gzip
131+
132+
- name: Publish to npm
133+
run: npm publish juno-node-${{ steps.version_check.outputs.rawVersion }}.tgz --tag beta
134+
env:
135+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/pr.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
8+
name: Continuous integration (PR)
9+
10+
jobs:
11+
version-check:
12+
if: github.base_ref == 'staging' || github.base_ref == 'master'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- run: git fetch --all --tags
17+
18+
- name: Check Release Version (staging)
19+
if: github.base_ref == 'staging'
20+
uses: thebongy/version-check@v1
21+
with:
22+
file: package.json
23+
tagFormat: v${version}-beta
24+
id: version_check_staging
25+
26+
- name: Check Release Version (master)
27+
if: github.base_ref == 'master'
28+
uses: thebongy/version-check@v1
29+
with:
30+
file: package.json
31+
tagFormat: v${version}
32+
id: version_check_master
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- run: git fetch --all --tags
38+
39+
- name: Check Release Version
40+
uses: thebongy/version-check@v1
41+
with:
42+
file: package.json
43+
id: version_check
44+
45+
- name: Setup nodejs
46+
uses: actions/setup-node@v1
47+
with:
48+
node-version: '12.x'
49+
50+
- name: Install dependencies
51+
run: npm ci
52+
53+
- name: Linting and tests
54+
run: npm run test:prod
55+
56+
- name: Build
57+
run: npm build
58+
59+
- name: Create tar
60+
run: npm pack
61+
62+
- name: Upload Artifact
63+
uses: actions/upload-artifact@v2
64+
with:
65+
name: juno-node@v${{ steps.version_check.outputs.releaseVersion }}-alpha
66+
path: ./juno-node-${{ steps.version_check.outputs.releaseVersion }}.tgz

.travis.yml.sample

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)