Skip to content

v2.18.0 update

v2.18.0 update #47

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
inputs:
build_name:
description: "Build name"
default: ""
required: false
type: string
test_build:
description: "Test build"
default: false
required: false
type: boolean
run-name: ${{ inputs.build_name }}
defaults:
run:
shell: bash
jobs:
# Create linux release file
linux:
runs-on: ubuntu-latest
outputs:
app_ver: ${{ steps.get_ver.outputs.app_ver }}
sha256: ${{ steps.get_hash.outputs.hash_output }}
steps:
- name: Checkout master and submodules
uses: actions/checkout@v4
with:
submodules: "true"
- name: Fetch version number
id: get_ver
run: |
tp_ver=$(grep "^VERSION" "./tinypedal/const.py" | sed 's/[A-Z\ \=\"]//g')
echo "app_ver=${tp_ver}" >> $GITHUB_OUTPUT
echo "TinyPedal Version:" $tp_ver
- name: ZIP Linux file
run: |
file_name=TinyPedal-${{ steps.get_ver.outputs.app_ver }}-linux.zip
zip -r $file_name . -x *.git*
- name: Check hash sum
id: get_hash
run: |
sha256hash=$(sha256sum TinyPedal-${{ steps.get_ver.outputs.app_ver }}-linux.zip)
echo "hash_output=${sha256hash}" >> $GITHUB_OUTPUT
echo $sha256hash
- name: Upload release files
uses: softprops/action-gh-release@v2
if: ${{ !inputs.test_build }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ steps.get_ver.outputs.app_ver }}
files: |
TinyPedal-${{ steps.get_ver.outputs.app_ver }}-linux.zip
# Create windows release file
windows:
runs-on: windows-latest
needs: linux
outputs:
sha256: ${{ steps.get_hash.outputs.hash_output }}
steps:
- name: Checkout master and submodules
uses: actions/checkout@v4
with:
submodules: "true"
- name: Set up Python 3.8 environment for Windows build
uses: actions/setup-python@v5
with:
python-version: "3.8"
architecture: "x64"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install py2exe
- name: Build Windows executable
run: |
python freeze_py2exe.py -c
- name: ZIP Windows file
shell: pwsh
run: |
$file_name="TinyPedal-${{ needs.linux.outputs.app_ver }}-windows.zip"
Compress-Archive -Path ./dist/TinyPedal -DestinationPath ./$file_name
- name: Check hash sum
id: get_hash
run: |
sha256hash=$(sha256sum TinyPedal-${{ needs.linux.outputs.app_ver }}-windows.zip | sed 's/\*//g')
echo "hash_output=${sha256hash}" >> $GITHUB_OUTPUT
echo $sha256hash
- name: Upload release files
uses: softprops/action-gh-release@v2
if: ${{ !inputs.test_build }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ needs.linux.outputs.app_ver }}
files: |
TinyPedal-${{ needs.linux.outputs.app_ver }}-windows.zip
# Generate release notes
release-notes:
runs-on: ubuntu-latest
needs: [linux, windows]
steps:
- name: Checkout master and submodules
uses: actions/checkout@v4
- name: Get latest change log
run: |
prev_line_num=$(grep -n "^\----*$" "./docs/changelog.txt" | sed -n "2,2p" | sed 's/[\:\-]//g')
sed -n "1,$(expr $prev_line_num - 2)p" "./docs/changelog.txt" >> release.txt
echo "Hash sum" >> release.txt
echo "---" >> release.txt
echo "SHA256:" ${{ needs.linux.outputs.sha256 }} >> release.txt
echo "SHA256:" ${{ needs.windows.outputs.sha256 }} >> release.txt
cat release.txt
- name: Update release notes
uses: softprops/action-gh-release@v2
if: ${{ !inputs.test_build }}
with:
body_path: release.txt
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ needs.linux.outputs.app_ver }}