Update release.yml #5
This file contains hidden or 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 & Release Executable | |
on: | |
push: | |
branches: | |
- main # Runs only on push to main | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- 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: Build Executables | |
run: | | |
pyinstaller recover.py --noconfirm --onefile --name "Data Recovery - Console" --console | |
pyinstaller recover.py --noconfirm --onefile --name "Data Recovery - Hidden" --windowed | |
- name: Rename Executables | |
run: | | |
mv dist/"Data Recovery - Console.exe" dist/data_recovery_console.exe | |
mv dist/"Data Recovery - Hidden.exe" dist/data_recovery_hidden.exe | |
- name: Get Last Commit Hash | |
id: get_commit | |
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Create Tag | |
run: | | |
git tag ${{ env.COMMIT_HASH }} | |
git push origin ${{ env.COMMIT_HASH }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.COMMIT_HASH }} | |
name: Release ${{ env.COMMIT_HASH }} # Corrected 'release_name' to 'name' | |
draft: false | |
prerelease: false | |
files: | | |
dist/data_recovery_console.exe | |
dist/data_recovery_hidden.exe |