Skip to content

Commit e854521

Browse files
committed
streamline CI
1 parent 9104f8a commit e854521

3 files changed

Lines changed: 78 additions & 29 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build & Publish Package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
increment:
7+
required: true
8+
type: string
9+
preid:
10+
required: false
11+
type: string
12+
13+
env:
14+
NODE_VERSION: 22
15+
16+
jobs:
17+
build-and-publish:
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 5
20+
steps:
21+
- uses: actions/checkout@v5
22+
with:
23+
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
24+
- uses: aboutbits/github-actions-base/git-setup@v2
25+
- uses: aboutbits/github-actions-node/build-and-publish-package@v3
26+
id: package
27+
with:
28+
node-version: ${{ env.NODE_VERSION }}
29+
registry-url: 'https://registry.npmjs.org'
30+
increment: ${{ github.event.inputs.increment }}
31+
preid: ${{ github.event.inputs.preid }}
32+
- uses: aboutbits/github-actions-base/github-create-release@v2
33+
with:
34+
tag-name: 'v${{ steps.package.outputs.version }}'

.github/workflows/pre-release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Pre-Release Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
increment:
7+
description: "Version increment type"
8+
type: choice
9+
required: true
10+
default: "prepatch"
11+
options:
12+
- "premajor"
13+
- "preminor"
14+
- "prepatch"
15+
preid:
16+
description: "--preid"
17+
type: string
18+
required: true
19+
20+
jobs:
21+
build-and-publish:
22+
uses: ./.github/workflows/build-and-publish.yml
23+
with:
24+
increment: ${{ github.event.inputs.increment }}
25+
preid: ${{ github.event.inputs.preid }}
26+
secrets: inherit

.github/workflows/release.yml

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,22 @@
1-
name: Create Relase & Publish Package
1+
name: Release Package
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
8-
env:
9-
NODE_VERSION: 22
4+
workflow_dispatch:
5+
inputs:
6+
increment:
7+
description: "Version increment type"
8+
type: choice
9+
required: true
10+
default: "patch"
11+
options:
12+
- "major"
13+
- "minor"
14+
- "patch"
15+
- "prerelease"
1016

1117
jobs:
12-
build:
13-
runs-on: ubuntu-24.04
14-
timeout-minutes: 5
15-
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/github-script@v7
18-
with:
19-
script: |
20-
github.rest.repos.createRelease({
21-
owner: context.repo.owner,
22-
repo: context.repo.repo,
23-
tag_name: '${{ github.ref }}',
24-
name: 'Release ${{ github.ref_name }}',
25-
prerelease: '${{ github.ref_name }}'.includes('-')
26-
})
27-
- uses: aboutbits/github-actions-node/setup-and-install@v2
28-
with:
29-
node-version: ${{ env.NODE_VERSION }}
30-
registry-url: 'https://registry.npmjs.org'
31-
- run: npm publish
32-
env:
33-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
18+
build-and-publish:
19+
uses: ./.github/workflows/build-and-publish.yml
20+
with:
21+
increment: ${{ github.event.inputs.increment }}
22+
secrets: inherit

0 commit comments

Comments
 (0)