-
Notifications
You must be signed in to change notification settings - Fork 14
145 lines (118 loc) · 4.04 KB
/
release.yml
File metadata and controls
145 lines (118 loc) · 4.04 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
name: Release
on:
workflow_dispatch:
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for release notes
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: smoosense-gui/pnpm-lock.yaml
- name: Wait for CI to pass
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: 'GUI Tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Wait for Python tests to pass
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: 'Python Tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Wait for integration tests to pass
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: 'Python Integration Tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Get previous version
id: prev_version
run: |
cd smoosense-py
PREV_VERSION=$(uv version --short)
echo "version=$PREV_VERSION" >> $GITHUB_OUTPUT
echo "Previous version: $PREV_VERSION"
- name: Bump version
run: |
cd smoosense-py
uv version --bump patch
- name: Get new version
id: new_version
run: |
cd smoosense-py
NEW_VERSION=$(uv version --short)
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "New version: $NEW_VERSION"
- name: Install dependencies
run: |
make -C smoosense-gui env
make -C smoosense-py env
- name: Build local
run: make build-local
- name: Commit and push version bump
run: |
git add -A
git commit -m "Release v${{ steps.new_version.outputs.version }}"
git push origin main
- name: Create and push tag
run: |
git tag -a "v${{ steps.new_version.outputs.version }}" -m "Release v${{ steps.new_version.outputs.version }}"
git push origin "v${{ steps.new_version.outputs.version }}"
- name: Publish to PyPI
run: make -C smoosense-py publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- name: Generate release notes
id: release_notes
run: |
PREV_TAG="v${{ steps.prev_version.outputs.version }}"
NEW_TAG="v${{ steps.new_version.outputs.version }}"
echo "Generating release notes from $PREV_TAG to $NEW_TAG"
# Get commit messages
COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"- %s (%h)" --no-merges)
# Create release notes
cat > release_notes.md <<EOF
## What's Changed
$COMMITS
**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...$NEW_TAG
EOF
cat release_notes.md
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.new_version.outputs.version }}
release_name: v${{ steps.new_version.outputs.version }}
body_path: release_notes.md
draft: false
prerelease: false