-
-
Notifications
You must be signed in to change notification settings - Fork 21
120 lines (95 loc) · 3.98 KB
/
build.yaml
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
name: Build and publish
env:
RELEASE_VERSION:
on:
repository_dispatch:
jobs:
linux-build:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up libraries
run: |
python -m pip install wheel pyinstaller
python -m pip install .
- name: Build
run: pyinstaller -F __main__.py -n deew --icon logo/icon.ico
- name: Create changelog file
run: python -c "print('\n'.join(open('changelog.md', 'r').read().split('\n\n# deew')[0].split('\n')[1:]))" >> changelog.txt
- name: Fetch changelog and version
run: |
version=$(python -c "print(open('changelog.md', 'r').read().split('\n')[0].split(' ')[2].replace(':', ''))")
changelog=$(cat changelog.txt)
echo -e "Version: $version\n\nChangelog:\n$changelog"
echo "RELEASE_VERSION=$version" >> "$GITHUB_ENV"
- name: Move dist/deew to deew_linux
run: mv dist/deew deew_linux
- name: Upload release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag_name: ${{ env.RELEASE_VERSION }}
body_path: changelog.txt
files: deew_linux
windows-build:
name: Windows
runs-on: windows-latest
needs: linux-build
steps:
- name: Checkout source
uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"
- name: Set up Python
run: |
Invoke-WebRequest -Uri "https://github.com/adang1345/PythonWin7/raw/master/3.12.1/python.3.12.1.nupkg" -OutFile "python.3.12.1.nupkg"
mkdir "C:\pywin7"
nuget install python -Source $(Get-Location) -OutputDirectory "C:\pywin7\"
echo "C:\pywin7\python.3.12.1\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Set up libraries
run: |
python -m pip install wheel poetry
python -m pip install "https://github.com/pcroland/Pyinstaller-Builds/releases/download/PyInstaller/pyinstaller-6.3.0-py3-none-win_amd64.whl"
python -m pip install .
- name: Fetch version
run: |
$version=$(python -c "print(open('changelog.md', 'r').read().split('\n')[0].split(' ')[2].replace(':', ''))")
echo "Version: $version"
echo "RELEASE_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Build
run: |
python -m PyInstaller -F __main__.py -n deew --icon logo/icon.ico
- name: Move dist/deew.exe to deew.exe
run: mv dist/deew.exe deew.exe
- name: Upload release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_TOKEN }}
tag_name: ${{ env.RELEASE_VERSION }}
files: deew.exe
- name: Upload release to PyPI
run: |
python -m poetry build
python -m poetry publish -u __token__ -p "${{ secrets.PYPI_TOKEN }}"
- name: Send Telegram notifications
continue-on-error: true
run: |
python dev_scripts/post/telegram.py "${{ secrets.TG_TOKEN }}" "${{ secrets.TG_CH1 }}"
python dev_scripts/post/telegram.py "${{ secrets.TG_TOKEN }}" "${{ secrets.TG_CH2 }}"
- name: Post changelog and update first post on Doom9
continue-on-error: true
run: python dev_scripts/post/doom9.py "${{ secrets.DOOM9_PASSWORD }}"
- name: Post on some other sites too
continue-on-error: true
run: |
curl -XPOST -u "pcroland:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/pcroland/deew_posts/dispatches --data '{\"event_type\": \"Posting\"}'
- name: Workflow finished
run: echo "Workflow finished."