Skip to content

Commit 2707040

Browse files
author
Christopher J Baker
authored
Merge pull request #86 from bitovi/v2
v2
2 parents 66f93a7 + 694e356 commit 2707040

File tree

86 files changed

+41208
-19383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+41208
-19383
lines changed

.depcheckrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
ignores: ["react", "react-dom", "src", "@webcomponents/custom-elements"]
1+
ignore-dirs:
2+
- /dist
3+
ignores:
4+
- "@types/*"

.eslintrc

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

.github/actions/build/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: monorepo-build
2+
3+
inputs:
4+
package:
5+
description: "The package folder name."
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
11+
steps:
12+
- name: Build
13+
shell: bash
14+
run: npx nx build ${{ inputs.package }}

.github/actions/check/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: monorepo-check
2+
3+
inputs:
4+
package:
5+
description: "The package folder name."
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
11+
steps:
12+
- name: Typecheck
13+
shell: bash
14+
run: npx nx typecheck ${{ inputs.package }}
15+
16+
- name: ESLint
17+
shell: bash
18+
run: npx nx eslint ${{ inputs.package }}
19+
20+
- name: Prettier
21+
shell: bash
22+
run: npx nx prettier ${{ inputs.package }}
23+
24+
- name: depcheck
25+
shell: bash
26+
run: npx nx depcheck ${{ inputs.package }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: monorepo-job-publish
2+
3+
inputs:
4+
segment:
5+
description: "The version segment to increment: major, minor, patch, or prerelease."
6+
required: true
7+
preId:
8+
description: "Appended to the prerelease segment. (default: \"\")"
9+
10+
runs:
11+
using: "composite"
12+
13+
steps:
14+
- name: Setup
15+
uses: ./.github/actions/setup
16+
17+
- name: Build
18+
uses: ./.github/actions/build
19+
with:
20+
package: ${{ github.workflow }}
21+
22+
- name: Publish to NPM
23+
uses: ./.github/actions/publish-npm
24+
with:
25+
package: ${{ github.workflow }}
26+
segment: ${{ github.event.inputs.segment }}
27+
preId: ${{ github.event.inputs.preId }}

.github/actions/job-verify/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: monorepo-job-verify
2+
3+
runs:
4+
using: "composite"
5+
6+
steps:
7+
- name: Setup
8+
uses: ./.github/actions/setup
9+
10+
- name: Check
11+
uses: ./.github/actions/check
12+
with:
13+
package: ${{ github.workflow }}
14+
15+
- name: Test
16+
uses: ./.github/actions/test
17+
with:
18+
package: ${{ github.workflow }}
19+
20+
- name: Build
21+
uses: ./.github/actions/build
22+
with:
23+
package: ${{ github.workflow }}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: monorepo-publish-npm
2+
3+
inputs:
4+
package:
5+
description: "The package folder name."
6+
required: true
7+
segment:
8+
description: "The version segment to increment: major, minor, patch, or prerelease."
9+
required: true
10+
preId:
11+
description: "Appended to the prerelease segment. (default: \"\")"
12+
13+
runs:
14+
using: "composite"
15+
16+
steps:
17+
- name: Determine Tag
18+
id: tag
19+
shell: bash
20+
run: |
21+
if [[ ${{ inputs.segment }} == pre* ]]; then
22+
echo "tag=next" >> $GITHUB_OUTPUT
23+
else
24+
echo "tag=latest" >> $GITHUB_OUTPUT
25+
fi
26+
27+
- name: Increment Version
28+
shell: bash
29+
run: |
30+
git config --local user.email "Workflow: ${{ inputs.package }}[bot]"
31+
git config --local user.name "${{ inputs.package }}[bot]@workflow"
32+
33+
TAG_CMD="--tag-version-prefix=\"${{ inputs.package }}/v\""
34+
MESSAGE_CMD="-m \"Publish ${{ inputs.package }} v%s\""
35+
36+
if [[ ${{ inputs.segment }} == pre* ]]; then
37+
if [[ -n "${{ inputs.preId }}" ]]; then
38+
PREID_CMD="--preid ${{ inputs.preId }}"
39+
fi
40+
fi
41+
42+
npm version ${{ inputs.segment }} $PREID_CMD $TAG_CMD $MESSAGE_CMD"
43+
44+
- name: Push Tag
45+
uses: ad-m/github-push-action@master
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
branch: ${{ github.ref }}
49+
tags: true
50+
51+
- name: Publish to NPM Registry
52+
working-directory: ${{ inputs.package }}
53+
uses: JS-DevTools/npm-publish@v2
54+
with:
55+
token: ${{ secrets.NPM_TOKEN }}
56+
tag: ${{ steps.tag.outputs.tag }}
57+
dry-run: true

.github/actions/setup/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: monorepo-setup
2+
3+
runs:
4+
using: "composite"
5+
6+
steps:
7+
- name: Setup Node.js environment
8+
uses: actions/setup-node@v3
9+
with:
10+
node-version-file: ".nvmrc"
11+
12+
- name: Install dependencies
13+
shell: bash
14+
run: npm ci

.github/actions/test/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: monorepo-test
2+
3+
inputs:
4+
package:
5+
description: "The package folder name."
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
11+
steps:
12+
- name: Test
13+
shell: bash
14+
run: npx nx test:ci ${{ inputs.package }}

.github/workflows/core.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "@r2wc/core"
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
segment:
8+
description: "The version segment to increment: major, minor, patch, or prerelease."
9+
required: true
10+
preId:
11+
description: "Appended to the prerelease segment. (default: \"\")"
12+
13+
jobs:
14+
verify:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Verify
22+
uses: ./.github/actions/job-verify
23+
24+
publish:
25+
if: github.event_name == 'workflow_dispatch'
26+
needs: verify
27+
28+
concurrency:
29+
group: "publish"
30+
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: write
34+
packages: write
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v3
39+
40+
- name: Publish
41+
uses: ./.github/actions/job-publish
42+
with:
43+
segment: ${{ github.event.inputs.segment }}
44+
preId: ${{ github.event.inputs.preId }}

0 commit comments

Comments
 (0)