Build EXE with Secrets #29
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 EXE with Secrets | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger workflow for main branch | |
| workflow_dispatch: # Allow manual runs | |
| jobs: | |
| build-exe: | |
| runs-on: windows-latest # Use Windows for building .exe files | |
| steps: | |
| # Step 1: Check out the code | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| # Step 2: Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.11 | |
| # Step 3: Install Python dependencies | |
| - name: Install Dependencies | |
| run: pip install -r requirements.txt | |
| # Step 4: Build the EXE | |
| - name: Build EXE | |
| env: # Pass secrets as environment variables | |
| VPN_USERNAME: ${{ secrets.VPN_USERNAME }} | |
| VPN_PASSWORD: ${{ secrets.VPN_PASSWORD }} | |
| TOTP_SECRET: ${{ secrets.TOTP_SECRET }} | |
| run: | | |
| echo "Building EXE..." | |
| pyinstaller --onefile totp.py | |
| # Step 5: Save the EXE in the Repository (Private) | |
| - name: Move EXE to Safe Location | |
| run: | | |
| mkdir -p compiled_exes | |
| move dist\\totp.exe compiled_exes\\my_private_totp.exe | |
| # Optional: Restrict write access in repo to trusted collaborators |