Skip to content

Commit 18bdb0a

Browse files
committed
ci: Update typescript example
0 parents  commit 18bdb0a

39 files changed

+1667
-0
lines changed

.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# all start with .(dot), including directories and files
2+
.*
3+
CHANGELOG.md
4+
CODE_OF_CONDUCT.md
5+
compose.yml
6+
CONTRIBUTING.md
7+
Dockerfile
8+
LICENSE*
9+
README.md
10+
SECURITY.md

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 120
10+
tab_width = 4
11+
trim_trailing_whitespace = true

.github/ISSUE_TEMPLATE/bug_report.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: 'bug: '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Bug description
11+
12+
<!-- A clear and concise description of what the bug is. -->
13+
14+
- Would you like to work on a fix? [y/n]
15+
16+
## To Reproduce
17+
18+
Steps to reproduce the behavior:
19+
20+
1. ...
21+
2. ...
22+
3. ...
23+
4. ...
24+
25+
<!-- Make sure you are able to reproduce the bug in the main branch, too. -->
26+
27+
## Expected behavior
28+
29+
<!-- A clear and concise description of what you expected to happen. -->
30+
31+
## Screenshots
32+
33+
<!-- If applicable, add screenshots to help explain your problem. -->
34+
35+
## Environment
36+
37+
<!-- Please fill the following information. -->
38+
39+
- OS: [e.g. Ubuntu 20.04]
40+
- example_ts version: [e.g. 0.1.0]
41+
42+
## Additional context
43+
44+
<!-- Add any other context about the problem here. -->

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: true
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: 'Feature Request: '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
## Motivations
11+
12+
<!--
13+
If your feature request is related to a problem, please describe it.
14+
-->
15+
16+
- Would you like to implement this feature? [y/n]
17+
18+
## Solution
19+
20+
<!-- Describe the solution you'd like. -->
21+
22+
## Alternatives
23+
24+
<!-- Describe any alternative solutions or features you've considered. -->
25+
26+
## Additional context
27+
28+
<!-- Add any other context or screenshots about the feature request here. -->

.github/PULL_REQUEST_TEMPLATE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Please explain the changes you made -->
2+
3+
<!--
4+
Please make sure:
5+
- you have read the contributing guidelines:
6+
https://github.com/x-pt/example-ts/blob/main/docs/CONTRIBUTING.md
7+
- you have updated the changelog (if needed):
8+
https://github.com/x-pt/example-ts/blob/main/CHANGELOG.md
9+
-->

.github/configs/labeler.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
version: 1
2+
3+
labels:
4+
# Type: Build-related changes
5+
- label: "@type/build"
6+
title: '^build(?:\(.+\))?\!?:'
7+
8+
# Type: CI-related changes
9+
- label: "@type/ci"
10+
title: '^ci(?:\(.+\))?\!?:'
11+
files:
12+
- '\.github/.+'
13+
14+
# Type: Documentation changes
15+
- label: "@type/docs"
16+
title: '^docs(?:\(.+\))?\!?:'
17+
files:
18+
- "docs/.+"
19+
- "**/*.md"
20+
21+
# Type: New feature
22+
- label: "@type/feature"
23+
title: '^feat(?:\(.+\))?\!?:'
24+
25+
# Type: Bug fix
26+
- label: "@type/fix"
27+
title: '^fix(?:\(.+\))?\!?:'
28+
29+
# Type: Improvements such as style changes, refactoring, or performance improvements
30+
- label: "@type/improve"
31+
title: '^(style|refactor|perf)(?:\(.+\))?\!?:'
32+
33+
# Type: Dependency changes
34+
- label: "@type/dependency"
35+
title: '^(chore|build)(?:\(deps\))?\!?:'
36+
37+
# Type: Test-related changes
38+
- label: "@type/test"
39+
title: '^test(?:\(.+\))?\!?:'
40+
files:
41+
- "tests/.+"
42+
- "spec/.+"
43+
44+
# Type: Security-related changes
45+
- label: "@type/security"
46+
title: '^security(?:\(.+\))?\!?:'
47+
files:
48+
- "**/security/.+"
49+
50+
# Issue Type Only: Feature Request
51+
- label: "Feature Request"
52+
type: issue
53+
title: "^Feature Request:"
54+
55+
# Issue Type Only: Documentation
56+
- label: "Documentation"
57+
type: issue
58+
title: "^.*(\b[Dd]ocumentation|doc(s)?\b).*"
59+
60+
# Issue Type Only: Bug Report
61+
- label: "Bug Report"
62+
type: issue
63+
title: "^.*(\b[Bb]ug|b(u)?g(s)?\b).*"

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
# Check for updates every Monday
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 10

.github/renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:base"
5+
]
6+
}

.github/workflows/cd.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: CD # Continuous Deployment or Delivery
2+
3+
on:
4+
push:
5+
# e.g. 1.0.0, v2.0.0, v0.1.0, v0.2.0-alpha, v0.3.0+build-71edf32
6+
tags:
7+
- '[v]?[0-9]+\.[0-9]+\.[0-9]+.*'
8+
9+
jobs:
10+
dd:
11+
name: Deploy or Delivery
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4

.github/workflows/ci.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI # Continuous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
build-and-test:
13+
name: Node.js-${{ matrix.node }} on ${{ matrix.os }}
14+
15+
strategy:
16+
matrix:
17+
node: [ 20, 22 ]
18+
os:
19+
- ubuntu-latest
20+
- windows-latest
21+
- macos-latest
22+
23+
fail-fast: false
24+
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: pnpm/action-setup@v4
30+
with:
31+
version: 9
32+
33+
- name: Set up Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: ${{ matrix.node }}
37+
# cache: "pnpm"
38+
39+
- name: Build
40+
run: |
41+
pnpm i
42+
pnpm build
43+
44+
- name: Test
45+
run: pnpm test
46+

.github/workflows/docker.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '^v[0-9]+\.[0-9]+\.[0-9]+.*$'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v4
15+
-
16+
name: Acquire tag name
17+
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#refs/*/}" >> $GITHUB_ENV
18+
-
19+
name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
-
22+
name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
-
25+
name: Login to GitHub Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
-
32+
name: Build and Export to Docker
33+
uses: docker/build-push-action@v6
34+
with:
35+
context: .
36+
load: true
37+
tags: |
38+
ghcr.io/x-pt/example-ts:latest
39+
ghcr.io/x-pt/example-ts:${GITHUB_REF_NAME:1}
40+
-
41+
name: Test it before Push
42+
run: |
43+
docker run --rm ghcr.io/x-pt/example-ts:latest
44+
docker run --rm ghcr.io/x-pt/example-ts:${GITHUB_REF_NAME:1}
45+
-
46+
name: Build and Push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: |
53+
ghcr.io/x-pt/example-ts:latest
54+
ghcr.io/x-pt/example-ts:${GITHUB_REF_NAME:1}

.github/workflows/labeler.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Labeler
2+
3+
on:
4+
- pull_request
5+
- issues
6+
7+
jobs:
8+
labeler:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: srvaroa/labeler@master
12+
with:
13+
config_path: .github/configs/labeler.yml
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Example Ts Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
changelog:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Get Tag Version
18+
id: tag_version
19+
run: echo "CURRENT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
20+
21+
- name: Generate Full Changelog
22+
uses: orhun/git-cliff-action@v4
23+
with:
24+
config: cliff.toml
25+
args: --verbose
26+
env:
27+
OUTPUT: CHANGELOG.md
28+
GITHUB_REPO: ${{ github.repository }}
29+
30+
- name: Commit Changelog
31+
run: |
32+
git config user.name 'github-actions[bot]'
33+
git config user.email 'github-actions[bot]@users.noreply.github.com'
34+
set +e
35+
git switch main
36+
git add CHANGELOG.md
37+
git commit -m "chore(release-bot): prepare for release notes on ${CURRENT_TAG}"
38+
git push
39+
40+
release:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout Code
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Generate Latest Release Notes
49+
id: latest_release_notes
50+
uses: orhun/git-cliff-action@v4
51+
with:
52+
config: cliff.toml
53+
args: --latest --strip all
54+
env:
55+
OUTPUT: CHANGELOG.txt
56+
57+
- name: Create GitHub Release
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
body_path: CHANGELOG.txt

0 commit comments

Comments
 (0)