Skip to content

Commit 8a4e597

Browse files
committed
build: github action
1 parent b5a32a4 commit 8a4e597

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/pipeline.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v3
13+
# with:
14+
# ref: ${{ github.head_ref }}
15+
# fetch-depth: 0
16+
17+
- name: Configure Git
18+
run: |
19+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
20+
git config --local user.name "github-actions[bot]"
21+
22+
- name: Update package version and create Git tag
23+
run: |
24+
VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')
25+
npm version $VERSION --no-git-tag-version
26+
git add package.json
27+
git commit -m "chore(release): bump version to $VERSION"
28+
git tag -a $VERSION -m "chore(release): tag version $VERSION"
29+
30+
- name: Push Git tag
31+
run: git push origin ${{ github.event.release.tag_name }}
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
# - name: Push changes
36+
# uses: ad-m/github-push-action@master
37+
# with:
38+
# tags: true
39+
# branch: ${{ github.ref }}
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v3
43+
with:
44+
node-version: '20'
45+
registry-url: 'https://registry.npmjs.org/'
46+
47+
- name: Install dependencies
48+
run: npm install
49+
50+
- name: Build project
51+
run: npm run build
52+
53+
- name: Run tests and collect coverage
54+
run: npm run test:cov
55+
56+
# - name: Upload coverage reports to Codecov
57+
# uses: codecov/codecov-action@v4.0.1
58+
# with:
59+
# token: ${{ secrets.CODECOV_TOKEN }}
60+
# slug: wokim/nestjs-ddtrace
61+
# file: ./coverage/lcov.info
62+
# flags: unittests # Optional
63+
64+
- name: Publish to npm
65+
# run: npm publish
66+
# env:
67+
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
68+
uses: JS-DevTools/npm-publish@v1
69+
with:
70+
token: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)