Skip to content

Build New Release

Build New Release #90

Workflow file for this run

name: Build New Release
on:
release:
types: [published]
jobs:
handle-new-release:
runs-on: ubuntu-24.04
name: Process New Release
steps:
- name: Log Release Information
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
IS_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
echo "Release Tag: $RELEASE_TAG"
echo "Is Pre-Release: $IS_PRERELEASE"
build:
needs: [handle-new-release]
runs-on: windows-latest
name: Build Windows x64
defaults:
run:
shell: cmd
steps:
- name: Checkout Repository
uses: actions/checkout@v4.2.2
- name: Setup Python for x64 Build
uses: actions/setup-python@v5.3.0
with:
python-version: 3.x
architecture: x64
- name: Create a Python Virtual Environment
run: |
python -m venv --upgrade-deps "venv"
working-directory: .github/workflows
- name: Install Python Project Dependencies
run: |
venv\Scripts\pip install -r "..\..\requirements.txt"
venv\Scripts\pip install pyinstaller
working-directory: .github/workflows
- name: Build with PyInstaller
run: |
venv\Scripts\pyinstaller "session_sniffer.spec"
# Output will be in the `dist/` folder
working-directory: .github/workflows
- name: Upload Build Artifact
uses: actions/upload-artifact@v4.5.0
with:
name: Session_Sniffer.exe
path: .github/workflows/dist/Session_Sniffer.exe
upload-release-artifact:
needs: [build]
runs-on: ubuntu-24.04
name: Upload Release Artifact
steps:
- name: Checkout Repository
uses: actions/checkout@v4.2.2
- name: Download Build Artifact
uses: actions/download-artifact@v4.1.8
with:
path: artifacts
name: Session_Sniffer.exe
- name: Upload Artifact to Release
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
GH_TOKEN: ${{ github.token }}
run: |
echo "Uploading release artifact..."
gh release upload "$RELEASE_TAG" \
"artifacts/Session_Sniffer.exe"
update-version-info:
needs: [upload-release-artifact]
runs-on: ubuntu-24.04
name: Update Version Info
steps:
- name: Checkout Version Branch
uses: actions/checkout@v4.2.2
with:
ref: version
- name: Fetch Latest Changes and Checkout Main Branch Script
run: |
# Fetch all branches to ensure we have the latest changes
git fetch --all
# Checkout the update_release_versions.py script from the main branch
git checkout origin/main -- .github/workflows/scripts/update_release_versions.py
- name: Set Git Identity for Commits
run: |
# Set GitHub Actions bot identity for commits
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup Python Environment
uses: actions/setup-python@v5.3.0
with:
python-version: 3.x
- name: Install Packaging Python Library
run: |
pip install packaging
- name: Run Version Update Script
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
IS_PRERELEASE: ${{ github.event.release.prerelease }}
run: |
# Determine if the release is a pre-release and build the appropriate argument
PRERELEASE_ARG=""
if [ "$IS_PRERELEASE" = "true" ]; then
PRERELEASE_ARG="--prerelease"
fi
# Execute the Python version update script with the release tag and prerelease argument
python ".github/workflows/scripts/update_release_versions.py" "$RELEASE_TAG" $PRERELEASE_ARG
- name: Ensure Script Is Not Staged for Commit
run: |
# Ensure the script is not staged for commit
# This is to prevent the script from being committed to the repository
git reset ".github/workflows/scripts/update_release_versions.py"
- name: Remove Temporary Script Path
run: |
# Delete the "update_release_versions.py" script path after it's used to avoid committing it
rm -rf ".github/"
- name: Commit and Push Changes to release_versions.json
run: |
# Stage the modified release_versions.json file for commit
git add "release_versions.json"
# Commit the changes with a meaningful message
git commit -m "Update release_versions.json"
# Push Changes
git push origin version