Skip to content

Weekly Build and Release #28

Weekly Build and Release

Weekly Build and Release #28

name: Weekly Build and Release
on:
schedule:
- cron: '0 0 * * 0' # Runs at midnight (UTC) every Sunday
workflow_dispatch: # Keep manual trigger for testing
permissions:
contents: write
issues: write
jobs:
check_and_build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for calculating version
- name: Check for changes
id: check_changes
shell: bash # Switch to bash for more reliable git commands
run: |
# Try to get the latest tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
if [ "$LAST_TAG" = "none" ]; then
echo "No previous tags found. Proceeding with initial release."
echo "HAS_CHANGES=true" >> $GITHUB_ENV
echo "COMMIT_COUNT=all" >> $GITHUB_ENV
else
# Count commits between last tag and HEAD
COMMIT_COUNT=$(git rev-list $LAST_TAG..HEAD --count)
echo "Found $COMMIT_COUNT commits since last release ($LAST_TAG)"
if [ "$COMMIT_COUNT" -gt "0" ]; then
echo "HAS_CHANGES=true" >> $GITHUB_ENV
echo "COMMIT_COUNT=$COMMIT_COUNT" >> $GITHUB_ENV
else
echo "HAS_CHANGES=false" >> $GITHUB_ENV
echo "COMMIT_COUNT=0" >> $GITHUB_ENV
fi
fi
# Debug step to verify the environment variables
- name: Debug Change Detection
shell: bash
run: |
echo "HAS_CHANGES: ${{ env.HAS_CHANGES }}"
echo "COMMIT_COUNT: ${{ env.COMMIT_COUNT }}"
echo "Latest commits:"
git log -n 5 --pretty=format:"%h - %s" --graph
- name: Set up Python 3.10
if: env.HAS_CHANGES == 'true'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Update Version
if: env.HAS_CHANGES == 'true'
id: version
run: |
# Read current version
$CURRENT_VERSION = Get-Content version.txt -TotalCount 1 | ForEach-Object { $_.Trim() }
# Remove 'v' prefix for calculation and split version
$VERSION_NUMBER = $CURRENT_VERSION -replace '^v', ''
$VERSION_PARTS = $VERSION_NUMBER -split '\.'
$MAJOR = [int]$VERSION_PARTS[0]
$MINOR = [int]$VERSION_PARTS[1]
$PATCH = [int]$VERSION_PARTS[2]
# Increment minor version
$NEW_MINOR = $MINOR + 1
$NEW_VERSION = "v$MAJOR.$NEW_MINOR.0"
# Note: Patch gets reset back to zero as we increment minor
# Update version.txt
$NEW_VERSION | Set-Content version.txt
# Set as environment variable
echo "PREV_VERSION=$CURRENT_VERSION" >> $env:GITHUB_ENV
echo "VERSION=$NEW_VERSION" >> $env:GITHUB_ENV
echo "Updated version from $CURRENT_VERSION to $NEW_VERSION"
# Stage version.txt for commit
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add version.txt
git commit -m "Bump version to $NEW_VERSION"
git push
- name: Install dependencies
if: env.HAS_CHANGES == 'true'
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build application with PyInstaller
if: env.HAS_CHANGES == 'true'
run: |
pyinstaller main.spec
- name: Upload built executable
if: env.HAS_CHANGES == 'true'
uses: actions/upload-artifact@v3
with:
name: PYNQ-SoC-Builder
path: dist/PYNQ-SoC-Builder.exe
- name: Create Release
if: env.HAS_CHANGES == 'true'
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
body: |
Thank you for checking out the bundled release of PYNQ SoC Builder. This release consists of a single exe file intended for Windows machines.
Bundled releases are intended for anyone who wishes to give SoC Builder a try for the first time quick and easily.
Note to Students: It is recommended to clone the repository instead, as this way you will receive new features and improvements as soon as possible over the course of the semester.
If you encounter any problems, please open an issue or reach out to @lukecanny.
All the best, Logicademy Team 😎
Please Note: This free, open-source application is not digitally signed since code signing certificates cost several hundred dollars annually. When you first run the application, Windows Defender may show a warning message - this is normal for unsigned applications. You can safely proceed by clicking "More info" and then "Run anyway". The source code is available at github.com/Logicademy/PYNQ-SoC-Builder if you'd like to review it or build it yourself.
**Full Changelog:** https://github.com/Logicademy/PYNQ-SoC-Builder/compare/${{ env.PREV_VERSION }}...${{ env.VERSION}}
draft: true
files: dist/PYNQ-SoC-Builder.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}