Skip to content

Add black formatting to ci workflow #37

Add black formatting to ci workflow

Add black formatting to ci workflow #37

Workflow file for this run

name: troppical-build
on:
push:
branches: [ "*" ]
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ master ]
workflow_dispatch:
inputs:
release:
description: 'Create Release'
required: true
type: boolean
default: false
jobs:
black-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install black
- run: black --check --diff .
- run: black .
Windows-build:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache pip
uses: actions/cache@v3
with:
path: |
~\AppData\Local\pip\Cache
~\AppData\Local\pyinstaller\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Install dependencies
run: |
pip install --cache-dir=~/.pip-cache -r requirements.txt
- name: Build
shell: bash
run: |
pyinstaller Troppical.spec
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: troppical-windows
path: |
${{ github.workspace }}/dist/Troppical.exe
create-release:
needs: [Windows-build]
if: github.event.inputs.release == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get current date
id: date
run: |
echo "version=$(date +'%y.%m%d')" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: troppical-windows
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD }}
with:
tag_name: ${{ steps.date.outputs.version }}
release_name: Troppical ${{ steps.date.outputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/Troppical.exe
asset_name: Troppical.exe
asset_content_type: application/octet-stream