Update build.yml #4
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 Release | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
# Agregamos los permisos necesarios | |
permissions: | |
contents: write | |
discussions: write | |
jobs: | |
build-and-release: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Create spec file | |
run: | | |
echo 'block_cipher = None | |
a = Analysis( | |
["Cli.py"], | |
pathex=["."], | |
binaries=[], | |
datas=[ | |
("src/*.py", "src"), | |
("src/config.py", "src"), | |
("src/ui.py", "src"), | |
("src/scraper.py", "src"), | |
("assets/*", "assets") | |
], | |
hiddenimports=[], | |
hookspath=[], | |
hooksconfig={}, | |
runtime_hooks=[], | |
excludes=[], | |
win_no_prefer_redirects=False, | |
win_private_assemblies=False, | |
cipher=block_cipher, | |
noarchive=False, | |
) | |
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | |
exe = EXE( | |
pyz, | |
a.scripts, | |
a.binaries, | |
a.zipfiles, | |
a.datas, | |
[], | |
name="nyaaCli", | |
debug=False, | |
bootloader_ignore_signals=False, | |
strip=False, | |
upx=True, | |
upx_exclude=[], | |
runtime_tmpdir=None, | |
console=True, | |
disable_windowed_traceback=False, | |
target_arch=None, | |
codesign_identity=None, | |
entitlements_file=None, | |
icon="assets/icon.ico" | |
)' > nyaa_cli.spec | |
- name: Build executable | |
run: | | |
pyinstaller nyaa_cli.spec | |
- name: Zip Release | |
run: | | |
cd dist | |
7z a -tzip nyaaCli.zip nyaaCli.exe | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: release-${{ steps.date.outputs.date }} | |
name: Release ${{ steps.date.outputs.date }} | |
files: | | |
dist/nyaaCli.zip | |
dist/nyaaCli.exe | |
body: | | |
## NyaaCli Release ${{ steps.date.outputs.date }} | |
Última compilación automática del NyaaCli | |
### Archivos: | |
- nyaaCli.exe: Ejecutable individual | |
- nyaaCli.zip: Ejecutable comprimido | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |