-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 2.94 KB
/
main.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
name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate changelog
id: changelog
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 HEAD)
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
# S'il n'y a pas de tag précédent, prendre tous les commits
echo "## 🚀 Changes in $LATEST_TAG" > CHANGELOG.md
echo "" >> CHANGELOG.md
# Features
echo "### ✨ Features" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" | grep "^* feat" >> CHANGELOG.md || true
echo "" >> CHANGELOG.md
# Fixes
echo "### 🐛 Bug Fixes" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" | grep "^* fix" >> CHANGELOG.md || true
echo "" >> CHANGELOG.md
# Other changes
echo "### 🔄 Other Changes" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" | grep -v "^* feat\|^* fix" >> CHANGELOG.md || true
else
echo "## 🚀 Changes in $LATEST_TAG" > CHANGELOG.md
echo "" >> CHANGELOG.md
# Features
echo "### ✨ Features" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" ${PREVIOUS_TAG}..HEAD | grep "^* feat" >> CHANGELOG.md || true
echo "" >> CHANGELOG.md
# Fixes
echo "### 🐛 Bug Fixes" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" ${PREVIOUS_TAG}..HEAD | grep "^* fix" >> CHANGELOG.md || true
echo "" >> CHANGELOG.md
# Other changes
echo "### 🔄 Other Changes" >> CHANGELOG.md
git log --no-merges --format="* %s (%h)" ${PREVIOUS_TAG}..HEAD | grep -v "^* feat\|^* fix" >> CHANGELOG.md || true
fi
CHANGELOG=$(cat CHANGELOG.md)
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build with PyInstaller
run: |
pyinstaller --onefile copilot-cli.py --add-data ./actions.yml:.
- name: Create tar.gz archive
run: |
cd dist
tar -czf copilot-cli.tar.gz *
mv copilot-cli.tar.gz ../
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
copilot-cli.tar.gz
body: |
${{ steps.changelog.outputs.CHANGELOG }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}