Skip to content

Commit 1ada2da

Browse files
committed
refactor: correct github folder
ci: add github actions
1 parent 39ea5cc commit 1ada2da

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

.github/workflows/nrc-build-test.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on:
2+
workflow_call:
3+
jobs:
4+
build-test:
5+
runs-on: ubuntu-latest
6+
outputs:
7+
semVer: ${{ steps.gitversion.outputs.semVer }}
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Use Node.js
11+
uses: actions/setup-node@v3
12+
with:
13+
node-version: 18.x
14+
cache: 'npm'
15+
# clean install
16+
- run: npm ci
17+
env:
18+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
19+
# build
20+
- run: npm run build --if-present
21+
# test
22+
- run: npm test
23+
24+

.github/workflows/nrc-ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Node-Rest-Client CI
2+
on:
3+
push:
4+
branches:
5+
- release
6+
jobs:
7+
build-test:
8+
uses: ./.github/workflows/nrc-build-test.yml
9+
publish-npm:
10+
needs: build-test
11+
runs-on: ubuntu-latest
12+
env:
13+
SEM_VERSION: ${{ needs.build-test.outputs.semVer }}
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18.x
19+
registry-url: https://registry.npmjs.org/
20+
- run: npm ci
21+
- run: npm publish
22+
env:
23+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/nrc-pr.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Node-Rest-Client PR
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
build-test:
8+
uses: ./.github/workflows/nrc-build-test.yml

.github/workflows/nrc-publish.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
workflow_call:
3+
jobs:
4+
build-test:
5+
runs-on: ubuntu-latest
6+
outputs:
7+
semVer: ${{ steps.gitversion.outputs.semVer }}
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Use Node.js
11+
uses: actions/setup-node@v3
12+
with:
13+
node-version: 18.x
14+
cache: 'npm'
15+
# install git version
16+
- name: Install GitVersion
17+
uses: gittools/actions/gitversion/setup@v0
18+
with:
19+
versionSpec: '5.x'
20+
preferLatestVersion: true
21+
# calculate git version
22+
- name: calculate semver
23+
id: gitversion # id to later be referenced
24+
uses: gittools/actions/gitversion/execute@v0
25+
26+
# clean install
27+
- run: npm ci
28+
# build
29+
- run: npm run build --if-present
30+
# test
31+
- run: npm publish
32+
env:
33+
semVersion: my_value
34+
# tag release
35+
36+
37+

0 commit comments

Comments
 (0)