-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.68 KB
/
release.yml
File metadata and controls
92 lines (79 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# .github/workflows/release.yml
name: Release
on:
push:
branches:
- main
# حذف pull_request trigger برای جلوگیری از اجرای مضاعف
permissions:
contents: write
issues: write
pull-requests: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
# شرط بهبود یافته - فقط زمانی اجرا شود که:
# 1. Push روی main باشد
# 2. Push توسط merge PR باشد (نه push مستقیم)
if: |
github.ref == 'refs/heads/main' &&
(
github.event_name == 'push' &&
contains(github.event.head_commit.message, 'Merge pull request')
)
steps:
- name: 🔍 Debug Info
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Branch: ${{ github.ref_name }}"
echo "Commit Message: ${{ github.event.head_commit.message }}"
echo "Actor: ${{ github.actor }}"
- name: 📥 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # برای semantic-release ضروری است
token: ${{ secrets.GITHUB_TOKEN }}
- name: 📦 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: 📋 Install dependencies
run: npm ci
- name: 🏗️ Build
run: npm run build
- name: 🔐 Audit
run: npm audit signatures
- name: 🧪 Run tests
run: npm run test:ci
# افزودن step برای بررسی commit messages
- name: 🔍 Check Recent Commits
run: |
echo "Last 5 commits:"
git log --oneline -5
echo "Checking for conventional commits..."
git log --pretty=format:"%s" -10 | head -5
- name: 🔍 Debug semantic-release (dry-run)
run: |
echo "Running semantic-release in dry-run mode..."
npx semantic-release --dry-run --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 🚀 Release
run: |
echo "Running semantic-release..."
npx semantic-release --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 📊 Release Status
if: always()
run: |
echo "✅ Release workflow completed"
echo "Check the logs above for any issues"