Skip to content

Commit

Permalink
Merge pull request #38 from thethiny/master
Browse files Browse the repository at this point in the history
Add GitHub Actions workflow
  • Loading branch information
bnnm authored May 26, 2024
2 parents aabcf0e + 095e696 commit 03dd6be
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 1 deletion.
50 changes: 50 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build-wwiser-nightly

on:
push:
branches:
- master
paths: # Run on any code change
- "wwiser/**/*.py"
- "wwiser.py"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
release-new-nightly:
runs-on: windows-2019

steps:
# Checkout your code
- name: Checkout
uses: actions/checkout@v2

# Setup env
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

# Make release version tag
- name: Get Release Version
id: release_version
run: |
$DateString = Get-Date -Format "yyyyMMdd"
echo "wwiser_version=$DateString" >> $env:GITHUB_OUTPUT
# Build app
- name: Build WWiser
run: python build.py ${{ steps.release_version.outputs.wwiser_version }}

# Release nightly
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: ./bin/wwiser.pyz
name: ${{ env.WWISER_VERSION}}-nightly
tag_name: latest-nightly
prerelease: true
env:
WWISER_VERSION: v${{ steps.release_version.outputs.wwiser_version }}
49 changes: 49 additions & 0 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build-wwiser-stable

on:
push:
branches:
- master
paths: # Only run on new version
- "wwiser/wversion.py"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
release-new-version:
runs-on: windows-2019

steps:
# Checkout your code
- name: Checkout
uses: actions/checkout@v2

# Setup env
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

# Make release version tag
- name: Get Release Version
id: release_version
run: |
$WwiserVersion = $(python -c "from wwiser.wversion import WWISER_VERSION; print(WWISER_VERSION)")
echo "WWISER_VERSION=$WwiserVersion" >> $env:GITHUB_OUTPUT
# Build app
- name: Build WWiser
run: python build.py ${{ steps.release_version.outputs.wwiser_version }}

# Create stable release
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: ./bin/wwiser.pyz
name: ${{ env.WWISER_VERSION}}
tag_name: ${{env.WWISER_VERSION}}
# body_path: /path/to/CHANGELOG.TXT # If not present then it's latest commit message
env:
WWISER_VERSION: ${{ steps.release_version.outputs.wwiser_version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.*
!/.gitignore
!.gitattributes
!.github/
*.user
*.o
*.a
Expand Down
7 changes: 6 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import glob, os, zipfile
from datetime import datetime
import sys

def make_pyz():
if not os.path.exists('bin'):
Expand All @@ -19,7 +20,11 @@ def make_pyz():
continue
zf.write(filename, compress_type=zipfile.ZIP_DEFLATED)

strdate = datetime.today().strftime('%Y%m%d')
if len(sys.argv) > 1: # Accept version from cli
strdate = sys.argv[1]
strdate = strdate.lstrip("v")
else:
strdate = datetime.today().strftime('%Y%m%d')
#zf.writestr('VERSION', strdate, compress_type=zipfile.ZIP_DEFLATED)
version = 'WWISER_VERSION = "v%s"' % (strdate)
zf.writestr('wwiser/wversion.py', version, compress_type=zipfile.ZIP_DEFLATED) # './...' fails here
Expand Down

0 comments on commit 03dd6be

Please sign in to comment.