Skip to content

Commit 9b0ec5b

Browse files
ci: use reusable workflows
1 parent 02fd307 commit 9b0ec5b

5 files changed

Lines changed: 33 additions & 153 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,12 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
lint:
14-
name: Lint
15-
runs-on: ubuntu-latest
16-
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v6
20-
with:
21-
fetch-depth: 0
22-
23-
- name: Set up Node.js
24-
uses: actions/setup-node@v6
25-
with:
26-
node-version: 'lts/*'
27-
cache: 'npm'
28-
29-
- name: Install dependencies
30-
run: npm ci
31-
32-
- name: Check Prettier
33-
run: npx prettier --check .
34-
35-
- name: Check Commitlint (pull request)
36-
if: github.event_name == 'pull_request'
37-
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
38-
39-
- name: Check Commitlint (push)
40-
if: github.event_name == 'push'
41-
run: npx commitlint --last --verbose
42-
43-
- name: Check licenses
44-
run: npm run check:licenses
45-
46-
- name: Check types
47-
run: npm run build
48-
49-
- name: Lint
50-
run: npm run lint
13+
commits:
14+
name: Commits
15+
uses: NixySoftware/.github/.github/workflows/commits.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
16+
17+
typescript:
18+
name: TypeScript
19+
uses: NixySoftware/.github/.github/workflows/typescript.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
20+
with:
21+
enable-lint: false

.github/workflows/publish.yml

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,17 @@ on:
44
release:
55
types: [published]
66

7+
permissions:
8+
contents: read
9+
id-token: write
10+
packages: write
11+
712
jobs:
813
publish:
914
name: Publish
10-
runs-on: ubuntu-latest
11-
12-
permissions:
13-
contents: read
14-
id-token: write
15-
packages: write
16-
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v6
20-
21-
- name: Set up Node.js
22-
uses: actions/setup-node@v6
23-
with:
24-
node-version: 'lts/*'
25-
cache: 'npm'
26-
registry-url: 'https://registry.npmjs.org'
27-
28-
- name: Install dependencies
29-
run: npm ci
30-
31-
- name: Build
32-
run: npm run build
33-
34-
- name: Publish to npm
35-
run: npm publish --access public --registry https://registry.npmjs.org --workspaces
36-
37-
- name: Set up Node.js
38-
uses: actions/setup-node@v6
39-
with:
40-
node-version: 'lts/*'
41-
cache: 'npm'
42-
registry-url: 'https://npm.pkg.github.com'
43-
44-
- name: Publish to GitHub Packages
45-
run: npm publish --access public --registry https://npm.pkg.github.com --workspaces
46-
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
uses: NixySoftware/.github/.github/workflows/publish.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
16+
with:
17+
enable-rust: false
18+
enable-typescript: true
19+
typescript-registry-github: true
20+
typescript-registry-npm: true

.github/workflows/pull-request.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ permissions:
88
contents: read
99

1010
jobs:
11-
lint-title:
12-
runs-on: ubuntu-latest
13-
name: Lint title
14-
15-
steps:
16-
- name: Conventional Commits
17-
uses: ytanikin/pr-conventional-commits@1.5.2
18-
with:
19-
task_types: '["build","chore","ci","docs","feat","fix","perf","refactor","revert","style","test"]'
20-
add_label: 'false'
11+
pull-request:
12+
name: Pull Request
13+
uses: NixySoftware/.github/.github/workflows/commits.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0

.github/workflows/release.yml

Lines changed: 9 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,16 @@ on:
1414

1515
permissions:
1616
contents: write
17-
packages: write
1817

1918
jobs:
2019
release:
2120
name: Release
22-
runs-on: ubuntu-latest
23-
24-
steps:
25-
- name: Generate GitHub App token
26-
id: app-token
27-
uses: getsentry/action-github-app-token@v3
28-
with:
29-
app_id: ${{ secrets.APP_ID }}
30-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
31-
32-
- name: Checkout
33-
uses: actions/checkout@v6
34-
35-
- name: Set up Node.js
36-
uses: actions/setup-node@v6
37-
with:
38-
node-version: 'lts/*'
39-
cache: 'npm'
40-
41-
- name: Install dependencies
42-
run: npm ci
43-
44-
- name: Bump version
45-
run: npx lerna version --no-git-tag-version --yes ${{ inputs.bump }}
46-
47-
- name: Extract version
48-
id: extract-version
49-
run: echo "VERSION=v$(jq -r .version ./lerna.json)" >> "$GITHUB_OUTPUT"
50-
51-
- name: Format with Prettier
52-
run: npx prettier --write .
53-
54-
- name: Add changes
55-
run: git add .
56-
57-
- name: Commit
58-
id: commit
59-
uses: dsanders11/github-app-commit-action@v2
60-
with:
61-
message: ${{ steps.extract-version.outputs.VERSION }}
62-
token: ${{ steps.app-token.outputs.token }}
63-
64-
- name: Reset and pull
65-
run: git reset --hard && git pull
66-
67-
- name: Tag
68-
uses: actions/github-script@v9
69-
env:
70-
GIT_TAG: ${{ steps.extract-version.outputs.VERSION }}
71-
GIT_SHA: ${{ steps.commit.outputs.sha }}
72-
with:
73-
script: |
74-
github.rest.git.createRef({
75-
owner: context.repo.owner,
76-
repo: context.repo.repo,
77-
ref: `refs/tags/${process.env.GIT_TAG}`,
78-
sha: process.env.GIT_SHA
79-
})
80-
81-
- name: Release
82-
uses: softprops/action-gh-release@v3
83-
with:
84-
generate_release_notes: true
85-
make_latest: true
86-
tag_name: ${{ steps.extract-version.outputs.VERSION }}
87-
token: ${{ steps.app-token.outputs.token }}
21+
uses: NixySoftware/.github/.github/workflows/release.yml@9704b92a2cefe90342562266d127a0c9dd132640 # v0.2.0
22+
with:
23+
bump: ${{ inputs.bump }}
24+
bump-rust: false
25+
bump-typescript: true
26+
extract-version: 'typescript'
27+
secrets:
28+
app-client-id: ${{ secrets.APP_ID }}
29+
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"scripts": {
1212
"build": "turbo build",
1313
"check:licenses": "license-checker-rseidelsohn --summary --excludePackagesStartingWith '@nixysoftware/' --onlyAllow '0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;BSD*;BlueOak-1.0.0;CC0-1.0;CC-BY-3.0;CC-BY-4.0;ISC;MIT;MPL-2.0;Python-2.0;Unlicense'",
14+
"check:types": "npm run build",
1415
"dev": "turbo dev",
1516
"lint": "turbo lint",
1617
"prepare": "npm run build"

0 commit comments

Comments
 (0)