Build #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |