-
Notifications
You must be signed in to change notification settings - Fork 19
119 lines (97 loc) · 4.09 KB
/
release.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Release Python Backend
on:
release:
types: [published]
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate changelog
id: changelog
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
echo "Previous tag: $PREVIOUS_TAG"
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"* %s (%h)" --no-merges)
else
CHANGELOG=$(git log --pretty=format:"* %s (%h)" ${PREVIOUS_TAG}..HEAD --no-merges)
fi
# Save changelog to file
echo "### What's Changed" > changelog.md
echo "" >> changelog.md
# Features
echo "#### ✨ Features" >> changelog.md
echo "$CHANGELOG" | grep -i "^* \(feat\|add\|new\)" >> changelog.md || true
echo "" >> changelog.md
# Bug Fixes
echo "#### 🐛 Bug Fixes" >> changelog.md
echo "$CHANGELOG" | grep -i "^* \(fix\|bug\|patch\)" >> changelog.md || true
echo "" >> changelog.md
# Improvements
echo "#### 📈 Improvements" >> changelog.md
echo "$CHANGELOG" | grep -i "^* \(improve\|update\|enhance\|refactor\)" >> changelog.md || true
echo "" >> changelog.md
# Documentation
echo "#### 📚 Documentation" >> changelog.md
echo "$CHANGELOG" | grep -i "^* \(doc\|docs\)" >> changelog.md || true
echo "" >> changelog.md
# Other Changes
echo "#### 🔄 Other Changes" >> changelog.md
echo "$CHANGELOG" | grep -v -i "^* \(feat\|add\|new\|fix\|bug\|patch\|improve\|update\|enhance\|refactor\|doc\|docs\)" >> changelog.md || true
# Escape special characters for GitHub Actions
CHANGELOG_CONTENT=$(cat changelog.md)
echo "changelog<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Download Latest Frontend Build
- name: Download frontend release
run: |
# Get latest release info from the frontend repository
LATEST_RELEASE=$(curl -s https://api.github.com/repos/eloravpn/EloraVPNManagerPanel/releases/latest)
DOWNLOAD_URL=$(echo $LATEST_RELEASE | jq -r '.assets[0].browser_download_url')
# Download the frontend build
curl -L -o frontend.zip "$DOWNLOAD_URL"
# Create static directory and extract frontend files
mkdir -p static
unzip frontend.zip -d static/
# Create archive
- name: Create archive
run: |
zip -r elora-vpn-backend.zip \
static/ \
pyqrcode/ \
main.py \
.env.example \
alembic.ini \
requirements.txt \
src/
- name: Attach build to release
run: |
gh release upload ${{ github.event.release.tag_name }} elora-vpn-backend.zip --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update release notes
run: |
gh release edit ${{ github.event.release.tag_name }} --notes "$(cat << 'EOT'
Release ${{ github.event.release.tag_name }} of Elora VPN Manager Backend
${{ env.CHANGELOG }}
### Quick Installation
```bash
curl -fsSL https://raw.githubusercontent.com/eloravpn/EloraVPNManager/main/install.sh | sudo bash
```
### Custom Installation
```bash
# With specific domain and port
curl -fsSL https://raw.githubusercontent.com/eloravpn/EloraVPNManager/main/install.sh | sudo bash -s -- \
--domain your-domain.com \
--port 8080
```
For more installation options and documentation, please visit our GitHub repository.
EOT
)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}