-
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(scripts): add scripts to be shared * refactor(scripts): improvements, code-review, refactors to be shareable * fix(scripts): correct lib.sh path * fix(scripts): correct lib.sh path * docs: improve script documentation a lot, refactor lib.sh log functions * docs: document more scripts * misc: renames * docs: document more scripts * fix: rename commitlint script * feat(changelog.sh): update to new changelog flags, update workflow and ci.sh * refactor(tag.sh): update h1 regex parsing, document regex * feat(ci.sh): trap SIGINT and print log location * misc: small fixes * fix(commitlint): extend base config * feat(workflows/release-pr): pass locally
- Loading branch information
Showing
17 changed files
with
1,256 additions
and
0 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,7 @@ | ||
config: | ||
- "**/*.yml" | ||
- "**/*.json" | ||
doc: | ||
- "**/*.md" | ||
shell: | ||
- "**/*.sh" |
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,62 @@ | ||
# https://commitlint.js.org/reference/rules.html | ||
defaultIgnores: true | ||
extends: "@commitlint/config-conventional" | ||
helpUrl: "" | ||
rules: | ||
body-leading-blank: | ||
- 2 | ||
- always | ||
body-max-line-length: | ||
- 2 | ||
- always | ||
- 100 | ||
footer-leading-blank: | ||
- 2 | ||
- always | ||
footer-max-line-length: | ||
- 2 | ||
- always | ||
- 100 | ||
header-max-length: | ||
- 2 | ||
- always | ||
- 100 | ||
header-trim: | ||
- 2 | ||
- always | ||
subject-case: | ||
- 2 | ||
- never | ||
- - sentence-case | ||
- start-case | ||
- pascal-case | ||
- upper-case | ||
subject-empty: | ||
- 2 | ||
- never | ||
subject-full-stop: | ||
- 2 | ||
- never | ||
- . | ||
type-case: | ||
- 2 | ||
- always | ||
- lower-case | ||
type-empty: | ||
- 2 | ||
- never | ||
type-enum: | ||
- 2 | ||
- always | ||
- - feat | ||
- fix | ||
- perf | ||
- refactor | ||
- docs | ||
- build | ||
- ci | ||
- revert | ||
- style | ||
- test | ||
- misc | ||
- chore |
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,122 @@ | ||
name: main | ||
run-name: ${{ github.head_ref }}@${{ github.sha }} | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
changed-files: | ||
name: analyze_changed_files | ||
runs-on: ubuntu-latest | ||
outputs: | ||
config: ${{ steps.list-changed-files.outputs.config_all_changed_files }} | ||
doc: ${{ steps.list-changed-files.outputs.doc_all_changed_files }} | ||
shell: ${{ steps.list-changed-files.outputs.shell_all_changed_files }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Changed files | ||
id: list-changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
# since_last_remote_commit: true # use only for testing, it's easy to produce no changed files | ||
files_yaml_from_source_file: .changed-files.yml | ||
|
||
debug: | ||
name: debug | ||
runs-on: ubuntu-latest | ||
if: false # change to debug | ||
env: | ||
HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
steps: | ||
- name: Debug | ||
run: true | ||
|
||
commitlint: | ||
name: commit_lint | ||
runs-on: ubuntu-latest | ||
needs: changed-files | ||
env: | ||
# will not be set when running on push/merge to main | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Create package-lock.json | ||
run: echo '{}' > package-lock.json | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: lts/iron | ||
cache: npm | ||
- run: npm --global install @commitlint/config-conventional | ||
|
||
- name: Run commitlint | ||
env: | ||
CONFIG_PATH: .commitlintrc.yml | ||
VERSION: 19.3.0 | ||
# will not be set when running on push/merge to main | ||
BASE_REF: ${{ github.event.pull_request.base.ref }} | ||
run: ./workflows/main/commit_lint.sh | ||
|
||
shell: | ||
name: lint_format_shell | ||
runs-on: ubuntu-latest | ||
needs: changed-files | ||
if: needs.changed-files.outputs.shell | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint and format | ||
uses: luizm/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SHFMT_OPTS: -d -i 2 -ln bash | ||
SHELLCHECK_OPTS: -x --severity=warning | ||
with: | ||
sh_checker_only_diff: true | ||
# needs write access https://github.com/luizm/action-sh-checker/pull/57 | ||
# sh_checker_comment: true | ||
|
||
config: | ||
name: format_config | ||
runs-on: ubuntu-latest | ||
needs: changed-files | ||
if: needs.changed-files.outputs.config | ||
env: | ||
FILES: ${{ needs.changed-files.outputs.config }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prettier | ||
uses: actionsx/prettier@v3 | ||
with: | ||
args: --check ${{ env.FILES }} | ||
|
||
spellcheck: | ||
name: spellcheck | ||
runs-on: ubuntu-latest | ||
needs: changed-files | ||
# doesn't work on local ci, finds 0 files and gives false ok | ||
if: (needs.changed-files.outputs.shell || needs.changed-files.outputs.doc) && github.event.local != true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cspell | ||
uses: streetsidesoftware/[email protected] | ||
with: | ||
files: "." | ||
incremental_files_only: true | ||
config: ./cspell.config.yml |
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,64 @@ | ||
name: release-pr | ||
run-name: release PR ${{ github.ref }}@${{ github.sha }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
url: | ||
description: Github repository URL to point commit links at | ||
required: true | ||
type: string | ||
title: | ||
description: Release title; new version and date will be added | ||
type: string | ||
tag_prefix: | ||
description: Prefix to be concatenated to semver tag, i.e ${PREFIX}v1.0.0 | ||
type: string | ||
|
||
jobs: | ||
release-pr: | ||
name: release PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Validate branch | ||
if: github.ref != 'refs/heads/main' && github.event.local != true | ||
run: | | ||
echo expected main, got: ${{ github.ref }} && exit 1 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go (local) | ||
if: github.event.local == true | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- run: go install ./cmd/changelog | ||
|
||
- name: Set up Go | ||
if: github.event.local != true | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
- run: go install github.com/tcodes0/go/cmd/[email protected] | ||
|
||
- name: Update changelog | ||
shell: bash | ||
env: | ||
CHANGELOG_FILE: CHANGELOG.md | ||
run: ./workflows/release/changelog.sh "${{ inputs.url }}" "${{ inputs.title }}" "${{ inputs.tag_prefix }}" | ||
|
||
- name: Open PR | ||
uses: peter-evans/[email protected] | ||
if: github.event.local != true | ||
with: | ||
commit-message: "chore: release ${{ inputs.title }}" | ||
title: "chore: release ${{ inputs.title }}" | ||
add-paths: . | ||
body: "" | ||
committer: release-workflow <41898282+github-actions[bot]@users.noreply.github.com> | ||
branch: release-${{ inputs.title }} | ||
branch-suffix: random |
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 | ||
run-name: release ${{ github.ref }}@${{ github.sha }} | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
release: | ||
name: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Push tag | ||
shell: bash | ||
env: | ||
CHANGELOG_FILE: CHANGELOG.md | ||
run: ./workflows/release/tag.sh |
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,2 @@ | ||
.local/* | ||
.env |
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,6 @@ | ||
bracketSpacing: true | ||
semi: false | ||
singleQuote: false | ||
trailingComma: es5 | ||
printWidth: 140 | ||
arrowParens: always |
Oops, something went wrong.