-
-
Notifications
You must be signed in to change notification settings - Fork 3
160 lines (134 loc) · 5.39 KB
/
release.yml
File metadata and controls
160 lines (134 loc) · 5.39 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.2.0)'
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: [self-hosted, macOS, ARM64]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Determine version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "📦 Building version: $VERSION"
- name: Update Info.plist version
run: |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ steps.version.outputs.version }}" Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ steps.version.outputs.version }}" Info.plist
- name: Build release
run: make release
- name: Calculate SHA256
id: sha
run: |
SHA256=$(shasum -a 256 dist/VPN-Bypass-${{ steps.version.outputs.version }}.dmg | awk '{print $1}')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
echo "📝 SHA256: $SHA256"
- name: Generate changelog
id: changelog
run: |
VERSION="v${{ steps.version.outputs.version }}"
PREV_TAG=$(git tag -l "v*" --sort=-version:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
PREV_TAG=$(git rev-list --max-parents=0 HEAD)
fi
echo "📝 Generating changelog from $PREV_TAG to $VERSION"
{
echo "## What's Changed"
echo ""
# Features
FEATURES=$(git log $PREV_TAG..HEAD --pretty=format:"- %s" --grep="^feat" 2>/dev/null || true)
if [ -n "$FEATURES" ]; then
echo "### ✨ Features"
echo "$FEATURES" | head -20
echo ""
fi
# Fixes
FIXES=$(git log $PREV_TAG..HEAD --pretty=format:"- %s" --grep="^fix" 2>/dev/null || true)
if [ -n "$FIXES" ]; then
echo "### 🐛 Bug Fixes"
echo "$FIXES" | head -20
echo ""
fi
# Other changes
OTHERS=$(git log $PREV_TAG..HEAD --pretty=format:"- %s" --invert-grep --grep="^feat" --invert-grep --grep="^fix" 2>/dev/null | head -10 || true)
if [ -n "$OTHERS" ]; then
echo "### 🔧 Other Changes"
echo "$OTHERS"
echo ""
fi
echo "---"
echo ""
echo "## Installation"
echo ""
echo "### Homebrew (recommended)"
echo '```bash'
echo "brew tap GeiserX/vpn-bypass"
echo "brew install --cask vpn-bypass"
echo '```'
echo ""
echo "### Manual Download"
echo "Download \`VPN-Bypass-${{ steps.version.outputs.version }}.dmg\` from the assets below."
echo ""
echo "---"
echo ""
echo "**SHA256:** \`${{ steps.sha.outputs.sha256 }}\`"
echo ""
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...$VERSION"
} > changelog.md
cat changelog.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: "VPN Bypass v${{ steps.version.outputs.version }}"
body_path: changelog.md
draft: false
prerelease: false
files: |
dist/VPN-Bypass-${{ steps.version.outputs.version }}.dmg
- name: Update Homebrew Cask
run: |
VERSION="${{ steps.version.outputs.version }}"
SHA256="${{ steps.sha.outputs.sha256 }}"
# Clone homebrew tap
git clone "https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/GeiserX/homebrew-vpn-bypass.git" homebrew-tap
cd homebrew-tap
# Update cask file
sed -i '' "s/version \".*\"/version \"$VERSION\"/" Casks/vpn-bypass.rb 2>/dev/null || \
sed -i "s/version \".*\"/version \"$VERSION\"/" Casks/vpn-bypass.rb
sed -i '' "s/sha256 \".*\"/sha256 \"$SHA256\"/" Casks/vpn-bypass.rb 2>/dev/null || \
sed -i "s/sha256 \".*\"/sha256 \"$SHA256\"/" Casks/vpn-bypass.rb
# Commit and push
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/vpn-bypass.rb
git diff --staged --quiet || git commit -m "Update vpn-bypass to v$VERSION"
git push
echo "✅ Homebrew cask updated to v$VERSION"
echo "## 🍺 Homebrew Cask Updated" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
echo "**SHA256:** $SHA256" >> $GITHUB_STEP_SUMMARY