-
-
Notifications
You must be signed in to change notification settings - Fork 81
80 lines (75 loc) · 2.4 KB
/
python-build-release.yml
File metadata and controls
80 lines (75 loc) · 2.4 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
name: Build release packages
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
id-token: write
attestations: write
jobs:
build-windows:
name: Build Windows MSI
runs-on: windows-latest
outputs:
release_url: ${{ steps.release.outputs.url }}
steps:
- uses: actions/checkout@master
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Build package
run: |
uv run --group build scripts/setup_msi.py bdist_msi --target-version ${{github.ref_name}}
- name: Attest build provenance
uses: actions/attest-build-provenance@v3
with:
subject-path: './dist/pyclashbot*.msi'
- name: Publish Release
uses: softprops/action-gh-release@v2
id: release
with:
prerelease: ${{startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'rc')}}
generate_release_notes: true
files: |
./dist/pyclashbot*.msi
build-macos:
name: Build macOS DMG
runs-on: macos-latest
steps:
- uses: actions/checkout@master
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Build package
run: |
uv run --group build scripts/setup_macos.py --target-version ${{github.ref_name}}
- name: Attest build provenance
uses: actions/attest-build-provenance@v3
with:
subject-path: './dist/py-clash-bot*.dmg'
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'rc')}}
files: |
./dist/py-clash-bot*.dmg
notify:
name: Send Discord notification
needs: [build-windows, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Trigger Discord Webhook
run: |
uv run --group build scripts/trigger_discord_webhook.py \
--version "${{ github.ref_name }}" \
--url "${{ needs.build-windows.outputs.release_url }}" \
--webhook-code "${{ secrets.DISCORD_WEBHOOK_CODE }}" \
${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'rc') && '--prerelease' || '' }}