-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (92 loc) · 3.35 KB
/
release-tagger.yaml
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
93
94
95
96
97
98
99
100
101
102
103
104
name: Auto Version Tag
on:
pull_request:
branches:
- main
types:
- closed
jobs:
Tagging:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.NPM_VERSIONER_APP_ID }}
private-key: ${{ secrets.NPM_VERSIONER_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
- name: git setting
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: npm tag(Major)
if: contains(github.event.pull_request.labels.*.name, 'PR:major')
run: |
npm version major
- name: npm tag(Minor)
if: contains(github.event.pull_request.labels.*.name, 'PR:minor')
run: |
npm version minor
- name: npm tag(Patch)
if: contains(github.event.pull_request.labels.*.name, 'PR:patch')
run: |
npm version patch
- name: Set up Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Fetch all branches
run: git fetch origin
- name: Rebase onto main
run: |
git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
git checkout dev
git merge --no-ff ${{ github.event.pull_request.head.ref }}
git branch -d ${{ github.event.pull_request.head.ref }}
- name: Send Discord Notification
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [
{
"title": "🚨 Rebase Conflict Detected!",
"description": "A rebase conflict occurred in the `develop` branch after merging into `main`. Please resolve it manually.",
"url": "https://github.com/UniPro-tech/ramura-utau-site",
"color": 16711680,
"fields": [
{
"name": "Branch",
"value": "`develop`"
},
{
"name": "Action Required",
"value": "Manual conflict resolution needed."
}
],
"footer": {
"text": "GitHub Actions Notification"
},
"timestamp": "'$(date --utc +%Y-%m-%dT%H:%M:%SZ)'"
}
]
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}
git reset --merge
- name: Delete branch
run: |
git push origin --delete ${{ github.event.pull_request.head.ref }}
continue-on-error: true
- name: Push changes
run: |
git push --all
git push --tags
git reset --merge
git checkout main
git push --all
git push --tags