Build binaries and Upload to Release #299
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 binaries and Upload to Release | |
on: | |
workflow_run: | |
workflows: ["Sync Version"] | |
types: | |
- completed | |
workflow_dispatch: {} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
artifact_name: ToolDelta-windows.exe | |
- os: ubuntu-latest | |
artifact_name: ToolDelta-linux | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: "Setup Python, Poetry and Dependencaies" | |
uses: packetcoders/action-setup-cache-python-poetry@main | |
with: | |
poetry-version: 1.7.1 | |
python-version: 3.12 | |
- name: Install dependencies | |
run: poetry install | |
- name: Build for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
poetry add pyinstaller | |
poetry run pyinstaller -F -i logo.ico -n ${{ matrix.artifact_name }} main.py | |
mv dist/${{ matrix.artifact_name }} . | |
- name: Build for Linux x86_64 | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
poetry add pyinstaller | |
poetry run pyinstaller -F -n ${{ matrix.artifact_name }} main.py | |
mv dist/${{ matrix.artifact_name }} . | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: ${{ matrix.artifact_name }} | |
build_changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install GitPython packaging pytz | |
- name: Build Changelog | |
run: | | |
python .github/release_produce.py | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: changelog | |
path: changelog.md | |
release: | |
needs: [build, build_changelog] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Get Version | |
run: echo "VERSION=$(<version)" >> $GITHUB_ENV | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.VERSION }} | |
name: ${{ env.VERSION }} | |
body_path: changelog/changelog.md | |
files: | | |
ToolDelta-windows.exe/ToolDelta-windows.exe | |
ToolDelta-linux/ToolDelta-linux |