Skip to content

Commit

Permalink
added ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Jul 26, 2024
1 parent c9866df commit 2eae112
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build and Release

on:
push:
branches:
- main

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12.4'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build executable
run: python src/setup.py build

- name: Zip HeadsetControl-Qt folder
run: |
$zipFile = "build/HeadsetControl-Qt_win64.zip"
$folder = "build/HeadsetControl-Qt"
Compress-Archive -Path $folder -DestinationPath $zipFile
shell: pwsh

- name: Upload HeadsetControl-Qt zip
uses: actions/upload-artifact@v3
with:
name: HeadsetControl-Qt
path: build/HeadsetControl-Qt_win64.zip

release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download HeadsetControl-Qt zip
uses: actions/download-artifact@v3
with:
name: HeadsetControl-Qt

- name: Bump version and create release
id: bump_release
run: |
git fetch --tags
# Determine the latest major version tag
LAST_MAJOR_TAG=$(git tag --list 'v*.*.*' | sed -E 's/^v?([0-9]+)\..*/\1/' | sort -nr | head -n 1)
# Increment the major version number
if [ -z "$LAST_MAJOR_TAG" ]; then
NEW_TAG="v1"
else
NEW_TAG="v$(($LAST_MAJOR_TAG + 1))"
fi
# Check if the tag already exists
if git rev-parse "$NEW_TAG" >/dev/null 2>&1; then
echo "Tag '$NEW_TAG' already exists. Incrementing to next major version."
LAST_MAJOR_TAG=$(git tag --list 'v*' | sed -E 's/^v?([0-9]+).*/\1/' | sort -nr | head -n 1)
NEW_TAG="v$(($LAST_MAJOR_TAG + 1))"
fi
echo "New tag is $NEW_TAG"
git tag $NEW_TAG
git push origin $NEW_TAG
echo "new_tag=$NEW_TAG" >> $GITHUB_ENV
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.new_tag }}
release_name: ${{ env.new_tag }}
body: ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload release assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: HeadsetControl-Qt_win64.zip
asset_name: HeadsetControl-Qt_win64.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ Then run it: `headsetcontrol-qt.py`

## To-do
- Add other headsetcontrol supported settings (My headset does not support them so i cannot test)
- Build linux appimage

0 comments on commit 2eae112

Please sign in to comment.