Skip to content

Commit 16da080

Browse files
committed
ci: setup semantic-release
1 parent 91e5d3d commit 16da080

File tree

8 files changed

+17684
-8469
lines changed

8 files changed

+17684
-8469
lines changed

.github/actions/build/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build
2+
description: Runs the build script and uploads the results as an artifact
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup repository
8+
uses: ./.github/actions/setup-repository
9+
10+
- name: Run build script
11+
shell: bash
12+
run: npm run build
13+
14+
- name: Generate a tarball from the build results
15+
if: '!cancelled()'
16+
shell: bash
17+
run: npm pack
18+
19+
- name: Upload the tarball as an artifact
20+
if: '!cancelled()'
21+
uses: actions/upload-artifact@v4
22+
with:
23+
path: msgroom-*.tgz

.github/actions/lint/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint
2+
description: Lints the codebase
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup repository
8+
uses: ./.github/actions/setup-repository
9+
10+
- name: Install website dependencies
11+
working-directory: ./website
12+
shell: bash
13+
run: npm ci
14+
15+
- name: Lint code
16+
shell: bash
17+
run: npm run lint

.github/workflows/CI.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,8 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v4
3232

33-
- name: Setup repository
34-
uses: ./.github/actions/setup-repository
35-
36-
- name: Install website dependencies
37-
working-directory: ./website
38-
run: npm ci
39-
40-
- name: Lint code
41-
run: npm run lint
33+
- name: Lint the codebase
34+
uses: ./.github/actions/lint
4235

4336
build:
4437
name: Build and check types
@@ -48,21 +41,8 @@ jobs:
4841
- name: Checkout repository
4942
uses: actions/checkout@v4
5043

51-
- name: Setup repository
52-
uses: ./.github/actions/setup-repository
53-
5444
- name: Run build script
55-
run: npm run build
56-
57-
- name: Generate a tarball from the build results
58-
if: '!cancelled()'
59-
run: npm pack
60-
61-
- name: Upload the tarball as an artifact
62-
if: '!cancelled()'
63-
uses: actions/upload-artifact@v4
64-
with:
65-
path: msgroom-*.tgz
45+
uses: ./.github/actions/build
6646

6747
test:
6848
name: Run tests

.github/workflows/npm-publish.yml

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

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Publish new release
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 0 18 * * 1
7+
8+
jobs:
9+
setup:
10+
name: Setup repository
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup repository
17+
uses: ./.github/actions/setup-repository
18+
19+
build:
20+
name: Build and check types
21+
runs-on: ubuntu-latest
22+
needs: [ setup ]
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Run build script
28+
uses: ./.github/actions/build
29+
30+
lint:
31+
name: Lint
32+
runs-on: ubuntu-latest
33+
needs: [ setup ]
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Lint the codebase
39+
uses: ./.github/actions/lint
40+
41+
test:
42+
name: Run tests
43+
runs-on: ubuntu-latest
44+
needs: [ build ]
45+
continue-on-error: true
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
50+
- name: Setup repository
51+
uses: ./.github/actions/setup-repository
52+
53+
- name: Run tests
54+
run: npm test
55+
56+
publish_release:
57+
permissions:
58+
contents: write
59+
id-token: write
60+
runs-on: ubuntu-latest
61+
needs: [ build, test, lint ]
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
66+
- name: Setup repository
67+
uses: ./.github/actions/setup-repository
68+
69+
- name: Create and publish a new release
70+
run: npx semantic-release
71+
env:
72+
NPM_TOKEN: ${{ secrets.NPM_TOKEN_MSGROOM }}
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Generate a tarball from the build results
76+
run: npm pack
77+
78+
- name: Upload the tarball as an artifact
79+
uses: actions/upload-artifact@v4
80+
with:
81+
path: msgroom-*.tgz

0 commit comments

Comments
 (0)