Decomission portable code. I think have multiple options is likely to… #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
# Make it appear in the GitHub web user interface, if this workflow is in the | |
# default branch, main. | |
workflow_dispatch: | |
push: | |
# Trigger workflow if the version number is changed or if the workflow | |
# itself is changed. | |
paths: | |
- 'assets/Version.ini' | |
- '.github/workflows/windows-build-version.yml' | |
permissions: | |
contents: write | |
# In this workflow the release version number is read from a .ini file. That is | |
# implemented by having one job read the file and print key-value pairs to its | |
# output. Another job then uses the output values. | |
# | |
# - Output is generated by the `check` job, in the step Get version number. | |
# - The values are consumed in the `build` job. | |
# | |
# There are two values, one guaranteed to have no spaces. | |
# | |
# And see the reference documentation here. | |
# https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs | |
jobs: | |
GetVersion: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
outputs: | |
# TOTH https://yamlchecker.com/ | |
VersionNumber: | |
${{ steps.get_version_number.outputs.VersionNumber }} | |
VersionNumberSpaceless: | |
${{ steps.get_version_number.outputs.VersionNumberSpaceless }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get version number | |
id: get_version_number | |
run: | | |
python src/utils/readini.py\ | |
assets/Version.ini Release VersionNumber >> "$GITHUB_OUTPUT" | |
cat "$GITHUB_OUTPUT" | |
RuffCheck: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ruff | |
- name: Analysing the code with ruff | |
run: | | |
ruff check . | |
# The build job runs on a Windows machine and performs various build steps. | |
build: | |
runs-on: windows-latest | |
needs: [GetVersion, RuffCheck] | |
env: | |
# Convenience variables with v prefix and short name. | |
VersionTag: v${{needs.GetVersion.outputs.VersionNumber}} | |
VersionTagSpaceless: v${{needs.GetVersion.outputs.VersionNumberSpaceless}} | |
steps: | |
- name: Create tag | |
# Tips of the hat. | |
# - Create a tag with GitHub Script | |
# https://stackoverflow.com/a/64479344/7657675 | |
# - Use environment variables | |
# https://stackoverflow.com/a/63485275/7657675 | |
# | |
# This step fails if the tag exists already, which is intentional. | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{env.VersionTagSpaceless}}", | |
sha: context.sha | |
}) | |
# Next step demonstrates use of an interim environment variable in case the | |
# tag contains a space. PowerShell will accept a single environment variable | |
# as a command line argument even if its value contains a space. | |
# - name: Demo environment variable and line continuation in PowerShell | |
# run: | | |
# $Env:TextFile = "delme-env-" + $Env:VersionTag + ".txt" | |
# New-Item ` | |
# $Env:TextFile ` | |
# -type file | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Freeze Installer | |
run: | | |
pyinstaller build.spec | |
- name: Build Installer | |
run: | | |
iscc installer.iss | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
# Reference documentation is near here. | |
# https://github.com/marketplace/actions/gh-release | |
with: | |
tag_name: ${{env.VersionTagSpaceless}} | |
name: ${{env.VersionTag}} | |
draft: false | |
prerelease: true | |
fail_on_unmatched_files: true | |
files: | | |
Output/FaceCommander-Installer-${{env.VersionTag}}.exe |