-
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.
Merge pull request #24 from Okabe-Junya/junya/feat/build-ci
feat: build, release CI
- Loading branch information
Showing
10 changed files
with
266 additions
and
24 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,51 @@ | ||
name-template: 'v$RESOLVED_VERSION 🌈' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- 'hotfix' | ||
- title: '🧰 Maintenance' | ||
labels: | ||
- 'chore' | ||
- 'chore: major' | ||
- 'chore: minor' | ||
- 'chore: patch' | ||
- 'refactor' | ||
- 'restructure' | ||
- 'cleanup' | ||
- 'ci' | ||
- 'perf' | ||
- 'build' | ||
- 'security' | ||
- 'infrastructure' | ||
- title: '📦 Dependencies' | ||
labels: | ||
- 'renovate' | ||
- title: '📚 Documentation' | ||
labels: | ||
- 'docs' | ||
- 'documentation' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'release: major' | ||
minor: | ||
labels: | ||
- 'release: minor' | ||
patch: | ||
labels: | ||
- 'release: patch' | ||
template: | | ||
## Changes | ||
$CHANGES | ||
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
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,29 @@ | ||
name: audit | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Audit dependencies | ||
run: yarn audit --groups dependencies --level moderate | ||
|
||
- name: Audit devDependencies | ||
run: yarn audit --groups devDependencies --level moderate |
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,42 @@ | ||
name: build and compare dist | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: rebuild | ||
run: yarn build | ||
|
||
- name: compare dist | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol ./dist | wc -l)" -gt "0" ]; then | ||
echo "dist is not up to date" | ||
git diff | ||
exit 1 | ||
fi | ||
id: diff | ||
|
||
- name: upload artifact | ||
if: ${{ steps.diff.outputs.exit_code == '1' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist |
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,82 @@ | ||
name: labeler bot | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited] | ||
issue_comment: | ||
types: [created, edited] | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check-label | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const labels = ["release: major", "release: minor", "release: patch", "release: none"]; | ||
const issue = context.issue; | ||
const issue_number = issue.number; | ||
const owner = issue.owner; | ||
const repo = issue.repo; | ||
const { data: issue_data } = await github.issues.get({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number | ||
}); | ||
const issue_labels = issue_data.labels.map(label => label.name); | ||
const is_release_label = labels.some(label => issue_labels.includes(label)); | ||
if (is_release_label) { | ||
core.setOutput("is_release_label", "true"); | ||
} else { | ||
core.setOutput("is_release_label", "false"); | ||
} | ||
- name: add-label | ||
if: steps.check-label.outputs.is_release_label == 'false' | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const issue = context.issue; | ||
const issue_number = issue.number; | ||
const owner = issue.owner; | ||
const repo = issue.repo; | ||
const comment = context.payload.comment.body; | ||
if (comment.match(/\/release major/)) { | ||
await github.issues.addLabels({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number, | ||
labels: ["release: major"] | ||
}); | ||
} else if (comment.match(/\/release minor/)) { | ||
await github.issues.addLabels({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number, | ||
labels: ["release: minor"] | ||
}); | ||
} else if (comment.match(/\/release patch/)) { | ||
await github.issues.addLabels({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number, | ||
labels: ["release: patch"] | ||
}); | ||
} else if (comment.match(/\/release none/)) { | ||
await github.issues.addLabels({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number, | ||
labels: ["release: none"] | ||
}); | ||
} else { | ||
await github.issues.createComment({ | ||
owner: owner, | ||
repo: repo, | ||
issue_number: issue_number, | ||
body: "Please add a label to this issue. \n\n- `/release major` \n- `/release minor` \n- `/release patch` \n- `/release none`" | ||
}); | ||
} |
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,22 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: release drafter | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
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
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
{ | ||
"name": "issue-validator", | ||
"version": "0.1.0", | ||
"main": "index.js", | ||
"version": "0.2.5", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "ncc build -o dist src/index.ts --license licenses.txt", | ||
"build:dry-run": "ncc build -o dist src/index.ts --license licenses.txt --no-cache", | ||
"lint": "eslint . --ext .ts", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"test": "jest", | ||
"prettier": "prettier --write ." | ||
}, | ||
"repository": "https://github.com/Okabe-Junya/issue-validator", | ||
"author": "Junya Okabe <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -31,12 +39,5 @@ | |
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2", | ||
"typescript-eslint": "^0.0.1-alpha.0" | ||
}, | ||
"scripts": { | ||
"build": "ncc build src/index.ts -o dist --license licenses.txt", | ||
"lint": "eslint . --ext .ts", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"test": "jest", | ||
"prettier": "prettier --write ." | ||
} | ||
} |