Skip to content

Commit b1361c5

Browse files
Merge pull request #3 from MostafaRastegar/develop
docs(README): update installation guide
2 parents b15c469 + 582c888 commit b1361c5

2 files changed

Lines changed: 122 additions & 45 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,73 @@ on:
55
branches:
66
- main
77
- next
8+
push:
9+
branches:
10+
- main
11+
- next
812

913
permissions:
1014
contents: write
1115
issues: write
1216
pull-requests: write
17+
packages: write
1318

1419
jobs:
1520
release:
1621
runs-on: ubuntu-latest
17-
# Only run if PR was merged (not just closed)
18-
if: github.event.pull_request.merged == true
22+
if: |
23+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
24+
(github.event_name == 'push')
25+
1926
steps:
20-
- uses: actions/checkout@v4
27+
- name: 🔍 Debug Info
28+
run: |
29+
echo "Event: ${{ github.event_name }}"
30+
echo "Ref: ${{ github.ref }}"
31+
echo "Branch: ${{ github.ref_name }}"
32+
echo "Merged: ${{ github.event.pull_request.merged }}"
33+
34+
- name: 📥 Checkout
35+
uses: actions/checkout@v4
2136
with:
2237
fetch-depth: 0 # Required for semantic-release
23-
ref: ${{ github.event.pull_request.base.ref }} # Checkout the target branch
38+
token: ${{ secrets.GITHUB_TOKEN }}
2439

25-
- uses: actions/setup-node@v4
40+
- name: 📦 Setup Node.js
41+
uses: actions/setup-node@v4
2642
with:
2743
node-version: "22.x"
2844
cache: 'npm'
45+
registry-url: 'https://registry.npmjs.org'
2946

30-
- run: npm ci
31-
- run: npm run build
32-
- run: npm audit signatures
47+
- name: 📋 Install dependencies
48+
run: npm ci
49+
50+
- name: 🏗️ Build
51+
run: npm run build
52+
53+
- name: 🔐 Audit
54+
run: npm audit signatures
3355

34-
# Optional: Run tests before release
35-
- name: Run tests
56+
- name: 🧪 Run tests
3657
run: npm run test:ci
3758

38-
- name: Release
59+
- name: 🔍 Debug semantic-release (dry-run)
60+
run: npx semantic-release --dry-run
3961
env:
4062
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4163
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42-
run: npx semantic-release
64+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
66+
- name: 🚀 Release
67+
run: npx semantic-release
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
73+
- name: 📊 Release Status
74+
if: always()
75+
run: |
76+
echo "✅ Release workflow completed"
77+
echo "Check the logs above for any issues"

release.config.cjs

Lines changed: 75 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,94 @@
11
// release.config.cjs
22
module.exports = {
33
branches: ["main", { name: "next", prerelease: true }],
4+
5+
// Debug mode
6+
debug: process.env.CI ? false : true,
7+
48
plugins: [
59
// 1. Analyze commits to determine release type
6-
"@semantic-release/commit-analyzer",
10+
[
11+
"@semantic-release/commit-analyzer",
12+
{
13+
preset: "angular",
14+
releaseRules: [
15+
// Documentation changes
16+
{ type: "docs", release: "patch" },
17+
{ type: "doc", release: "patch" },
718

8-
// 2. Generate release notes from commits
9-
"@semantic-release/release-notes-generator",
19+
// Code improvements
20+
{ type: "refactor", release: "patch" },
21+
{ type: "perf", release: "patch" },
1022

11-
// 3. Update CHANGELOG.md file
12-
"@semantic-release/changelog",
23+
// Features and fixes (default behavior)
24+
{ type: "feat", release: "minor" },
25+
{ type: "fix", release: "patch" },
1326

14-
// 4. Update package.json version and publish to NPM
15-
"@semantic-release/npm",
27+
// Breaking changes
28+
{ breaking: true, release: "major" },
1629

17-
// 5. Create Git tag and GitHub release with notes
18-
"@semantic-release/github",
30+
// No release for these
31+
{ type: "style", release: false },
32+
{ type: "chore", release: false },
33+
{ type: "test", release: false },
34+
{ type: "ci", release: false },
35+
{ type: "build", release: false },
36+
],
37+
parserOpts: {
38+
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"],
39+
},
40+
},
41+
],
1942

20-
// 6. Commit updated files (package.json, CHANGELOG.md)
43+
// 2. Generate release notes
44+
[
45+
"@semantic-release/release-notes-generator",
46+
{
47+
preset: "angular",
48+
writerOpts: {
49+
commitsSort: ["subject", "scope"],
50+
},
51+
},
52+
],
53+
54+
// 3. Update CHANGELOG.md
55+
[
56+
"@semantic-release/changelog",
57+
{
58+
changelogFile: "CHANGELOG.md",
59+
},
60+
],
61+
62+
// 4. Update package.json and publish to NPM
63+
[
64+
"@semantic-release/npm",
65+
{
66+
npmPublish: true,
67+
tarballDir: "dist",
68+
},
69+
],
70+
71+
// 5. Create GitHub release
72+
[
73+
"@semantic-release/github",
74+
{
75+
assets: [
76+
{
77+
path: "dist/*.tgz",
78+
label: "Package tarball",
79+
},
80+
],
81+
},
82+
],
83+
84+
// 6. Commit updated files (must be last)
2185
[
2286
"@semantic-release/git",
2387
{
24-
assets: ["CHANGELOG.md", "package.json"],
88+
assets: ["CHANGELOG.md", "package.json", "package-lock.json"],
2589
message:
2690
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
2791
},
2892
],
2993
],
30-
31-
// Commit message rules (conventional commits)
32-
preset: "angular",
33-
34-
// Custom release rules
35-
releaseRules: [
36-
{ type: "docs", scope: "README", release: "patch" },
37-
{ type: "refactor", release: "patch" },
38-
{ type: "perf", release: "patch" },
39-
{ type: "style", release: false },
40-
{ type: "chore", release: false },
41-
{ type: "test", release: false },
42-
{ type: "ci", release: false },
43-
],
44-
45-
// Configure release notes generation
46-
generateNotes: {
47-
preset: "angular",
48-
writerOpts: {
49-
commitsSort: ["subject", "scope"],
50-
},
51-
},
5294
};

0 commit comments

Comments
 (0)