Skip to content

Commit c404379

Browse files
authored
feat: add semantic-release (#3)
* feat: add semantic-release Signed-off-by: Xe Iaso <[email protected]> * ci: use stable Signed-off-by: Xe Iaso <[email protected]> --------- Signed-off-by: Xe Iaso <[email protected]>
1 parent be677ed commit c404379

File tree

5 files changed

+142
-78
lines changed

5 files changed

+142
-78
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: ["oldstable", "stable"]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go ${{ matrix.go-version }}
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
26+
- name: Cache Go modules
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-${{ matrix.go-version }}-
33+
34+
- name: Download dependencies
35+
run: go mod download
36+
37+
- name: Verify dependencies
38+
run: go mod verify
39+
40+
- name: Run go vet
41+
run: go vet ./...
42+
43+
- name: Run tests
44+
run: go test -race -coverprofile=coverage.out -v ./...
45+
46+
- name: Upload coverage to Codecov
47+
if: matrix.go-version == 'latest'
48+
uses: codecov/codecov-action@v4
49+
with:
50+
file: ./coverage.out
51+
flags: unittests
52+
name: codecov-umbrella
53+
fail_ci_if_error: false
54+
55+
lint:
56+
name: Lint
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Set up Go
63+
uses: actions/setup-go@v5
64+
with:
65+
go-version: "stable"
66+
67+
- name: Run golangci-lint
68+
uses: golangci/golangci-lint-action@v6
69+
with:
70+
version: "latest"
71+
args: --timeout=5m

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Set up Go stable
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: stable
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "20"
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: npx semantic-release

.releaserc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/changelog",
8+
{
9+
"changelogFile": "CHANGELOG.md"
10+
}
11+
],
12+
"@semantic-release/github",
13+
[
14+
"@semantic-release/exec",
15+
{
16+
"prepareCmd": "go mod tidy && go build -o bin/samesame ./..."
17+
}
18+
],
19+
[
20+
"@semantic-release/git",
21+
{
22+
"assets": ["CHANGELOG.md", "go.mod", "go.sum"],
23+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
24+
}
25+
]
26+
]
27+
}

README.md

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,3 @@
11
# samesame
22

33
The Web Bot Auth implementation for Anubis.
4-
5-
## Overview
6-
7-
A Go library providing basic arithmetic operations.
8-
9-
## Installation
10-
11-
```bash
12-
go get github.com/TecharoHQ/samesame
13-
```
14-
15-
## Usage
16-
17-
```go
18-
package main
19-
20-
import (
21-
"fmt"
22-
"github.com/TecharoHQ/samesame"
23-
)
24-
25-
func main() {
26-
result := samesame.Add(2, 3)
27-
fmt.Println(result) // Output: 5
28-
}
29-
```
30-
31-
## Development
32-
33-
This project uses the following tools:
34-
35-
- **Go**: Programming language
36-
- **goimports**: Automatic import formatting
37-
- **commitlint**: Commit message linting
38-
- **prettier**: Code formatting for JS/JSON/Markdown files
39-
- **husky**: Git hooks management
40-
41-
### Prerequisites
42-
43-
- Go 1.24+ installed
44-
- Node.js and npm installed
45-
46-
### Setup
47-
48-
1. Clone the repository
49-
2. Install dependencies:
50-
```bash
51-
npm install
52-
```
53-
54-
### Available Scripts
55-
56-
- `npm run test` - Run Go tests
57-
- `npm run fmt` - Format all code (Go and JS/JSON/Markdown)
58-
- `npm run lint` - Run Go vet for static analysis
59-
60-
### Pre-commit Hooks
61-
62-
The project includes pre-commit hooks that automatically:
63-
64-
- Format Go code with goimports and go fmt
65-
- Run go vet for static analysis
66-
- Run all tests
67-
- Format JavaScript, JSON, and Markdown files with prettier
68-
69-
### Commit Message Format
70-
71-
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification. Commit messages must be in the format:
72-
73-
```
74-
<type>: <description>
75-
```
76-
77-
Example: `feat: add new authentication method`
78-
79-
Valid types: feat, fix, docs, style, refactor, test, chore, etc.

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@
77
"test": "go test ./...",
88
"fmt": "prettier --write \"**/*.{js,json,md}\" && go tool goimports -w . && go fmt ./...",
99
"lint": "go vet ./...",
10-
"prepare": "husky"
10+
"prepare": "husky",
11+
"semantic-release": "semantic-release"
1112
},
1213
"keywords": [],
1314
"author": "",
1415
"license": "ISC",
1516
"devDependencies": {
1617
"@commitlint/cli": "^20.1.0",
1718
"@commitlint/config-conventional": "^20.0.0",
19+
"@semantic-release/changelog": "^6.0.3",
20+
"@semantic-release/exec": "^7.1.0",
21+
"@semantic-release/git": "^10.0.1",
22+
"@semantic-release/github": "^12.0.1",
23+
"conventional-changelog-conventionalcommits": "^9.1.0",
1824
"husky": "^9.1.7",
19-
"prettier": "^3.6.2"
25+
"prettier": "^3.6.2",
26+
"semantic-release": "^25.0.1"
2027
}
2128
}

0 commit comments

Comments
 (0)