-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): adds shareable Github Actions
- Loading branch information
1 parent
ca220bc
commit 6b6b4c1
Showing
13 changed files
with
256 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Setup Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
node_version: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Cache pnpm store | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store # Path to pnpm store | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} # Cache key based on OS and lockfile hash | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node_version}} | ||
|
||
- name: Install dependencies | ||
run: pnpm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Commitlint Check | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
edit: | ||
type: string | ||
required: true | ||
default: '.git/COMMIT_EDITMSG' | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Run Commitlint | ||
run: pnpm exec commitlint --edit ${{ inputs.edit }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: ESLint Check | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
maxWarnings: | ||
type: string | ||
required: false | ||
default: '0' | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
if: ${{ inputs.skip_checkout == false }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run ESLint | ||
run: pnpm exec eslint --max-warnings=${{ inputs.maxWarnings }} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: CI/CD Workflow | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
setup: | ||
uses: ./_base.yml@v1 | ||
with: | ||
node_version: '18' | ||
|
||
commitlint: | ||
needs: setup | ||
uses: ./commitlint.yml@v1 | ||
with: | ||
edit: '.git/COMMIT_EDITMSG' | ||
|
||
eslint: | ||
needs: setup | ||
uses: ./eslint-check.yml@v1 | ||
with: | ||
maxWarnings: '0' | ||
|
||
prettier: | ||
needs: setup | ||
uses: ./prettier-check.yml@v1 | ||
|
||
generate-writerside-docs: | ||
needs: setup | ||
if: github.ref == 'refs/heads/main' | ||
uses: ./generate_writerside_docs.yml@v1 | ||
with: | ||
npm_token: ${{ secrets.NPM_TOKEN }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
semantic-release: | ||
needs: setup | ||
if: github.ref == 'refs/heads/main' | ||
uses: ./semantic-release.yml@v1 | ||
with: | ||
node_version: '18' | ||
npm_token: ${{ secrets.NPM_TOKEN }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Publish to NPM | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
npm_token: | ||
type: string | ||
required: true | ||
npm_access: | ||
type: string | ||
default: 'public' | ||
required: false | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Publish to NPM | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.npm_token }} | ||
run: npm publish --access ${{ inputs.npm_access }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Prettier Check | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
skip_checkout: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Run Prettier Check | ||
run: pnpm prettier --check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Semantic Release | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
npm_token: | ||
type: string | ||
required: true | ||
github_token: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Run Semantic Release | ||
env: | ||
NODE_AUTH_TOKEN: ${{ inputs.npm_token }} | ||
GITHUB_TOKEN: ${{ inputs.github_token }} | ||
run: npx semantic-release |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ide/topics/How-to-Set-Up-and-Use-Reusable-GitHub-Actions-Across-Repositories.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# How to Set Up and Use Reusable GitHub Actions Across Repositories | ||
|
||
A How-to article is an action-oriented type of document. It explains how to perform a specific task | ||
or solve a problem, and usually contains a sequence of steps. Start with a short introductory | ||
paragraph that explains what users will accomplish by following this procedure, what they need to | ||
perform it for, or define the target audience of the doc. | ||
|
||
> **Note** | ||
> This guide assumes that you have installed `@kurocado-studio/style-guide` as a dev. dependency | ||
> | ||
> {style="note"} | ||
## Before you start | ||
|
||
It is good practice to list the prerequisites that are required or recommended. | ||
|
||
Make sure that: | ||
|
||
- First prerequisite | ||
- Second prerequisite | ||
|
||
## How to perform a task | ||
|
||
Some introductory information. | ||
|
||
1. Step with a code block | ||
|
||
```bash | ||
run this --that | ||
``` | ||
|
||
2. Step with a [link](https://www.jetbrains.com) | ||
|
||
3. Step with a list. | ||
- List item | ||
- List item | ||
- List item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters