Skip to content

Using Virtual Env in buildpieline #9

Using Virtual Env in buildpieline

Using Virtual Env in buildpieline #9

Workflow file for this run

name: Build and Release DotA2-Autoacecpter
on:
push:
tags:
- 'v*'
env:
TAG_NAME: ${{ github.ref_name }}
permissions:
id-token: write
contents: write
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Set environment variables
run: |
echo "EXPORT_NAME=dota2_autoaccepter_${TAG_NAME#'v'}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8'
cache: 'pip'
- name: Install Dependencies
run: |
python -m venv Env
source Env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build with PyInstaller
run: |
pyinstaller --onefile --add-data "templates:templates" --hidden-import=argparse --hidden-import=pynput.keyboard --name=$EXPORT_NAME autoaccepter/main.py
- name: Create Executable
uses: actions/upload-artifact@v4
with:
name: ${{ env.EXPORT_NAME }}
path: dist/${{ env.EXPORT_NAME }}
retention-days: 1
- name: Release
uses: softprops/action-gh-release@v2
with:
files: dist/${{ env.EXPORT_NAME }}
body: |
${{ github.event.head_commit.message }}
- name: Make Executable (Linux)
run: chmod +x dist/${{ env.EXPORT_NAME }}
if: runner.os == 'Linux'