Skip to content

Prefer parsing forum score from JSON-LD schema + BUILD #1186

Prefer parsing forum score from JSON-LD schema + BUILD

Prefer parsing forum score from JSON-LD schema + BUILD #1186

Workflow file for this run

name: "Build"
on:
workflow_dispatch:
push:
release:
types:
- "published"
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- { os: "windows-2019", python: "3.12.4", cx-freeze: "7.0.0", cx-logging: "v3.2.0" }
- { os: "ubuntu-20.04", python: "3.12.4", cx-freeze: "7.0.0", cx-logging: "" }
- { os: "macos-12", python: "3.12.4", cx-freeze: "7.0.0", cx-logging: "" }
name: "${{ matrix.config.os }}"
runs-on: "${{ matrix.config.os }}"
if: "github.event_name != 'push' || contains(github.event.head_commit.message, '+ BUILD')"
steps:
# === SETUP ===
- name: "Set git to use lf"
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: "Setup Python"
uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.config.python }}"
- name: "Setup cx_Freeze"
env:
CIBUILDWHEEL: "1"
shell: bash
run: |
if [ "${{ matrix.config.cx-logging }}" != "" ] ; then
python -m pip install -U 'git+https://github.com/anthony-tuininga/cx_Logging.git@${{ matrix.config.cx-logging }}'
fi
python -m pip install -U 'git+https://github.com/marcelotduarte/cx_Freeze.git@${{ matrix.config.cx-freeze }}'
# === BUILD ===
- name: "Clone repo"
uses: "actions/checkout@v4"
with:
path: "."
- name: "Install requirements"
run: |
python -m pip install -U -r ./requirements.txt
- name: "Mark as release"
if: "github.event_name == 'release'"
run: |
sed "s/release = False/release = True/g" ./main.py > ./main.py.new
rm ./main.py
mv ./main.py.new ./main.py
- name: "Mark build number"
if: "github.event_name != 'release'"
run: |
sed "s/build_number = 0/build_number = ${{ github.run_number }}/g" ./main.py > ./main.py.new
rm ./main.py
mv ./main.py.new ./main.py
- name: "Build (Windows, Linux)"
if: "runner.os != 'macOS'"
run: |
python ./setup.py build
mv ./build/exe.*/ ./dist/
- name: "Build (macOS)"
if: "runner.os == 'macOS'"
run: |
python ./setup.py bdist_mac
mkdir ./dist/
mv ./build/*.app/ ./dist/
- name: "Resolve symlinks (Linux, macOS)"
if: "runner.os != 'Windows'"
run: |
cd ./dist/
find ./ -type l -exec echo Resolving {} \; -exec sed -i '' {} \;
# - name: "Import codesign certificate (macOS)"
# if: "runner.os == 'macOS'"
# uses: "apple-actions/import-codesign-certs@v1"
# with:
# p12-file-base64: "${{ secrets.CODESIGN_P12_BASE64 }}"
# p12-password: "${{ secrets.CODESIGN_P12_PASSWORD }}"
# - name: "Codesign (macOS)"
# if: "runner.os == 'macOS'"
# run: |
# cd ./dist/
# find ./ -type f -empty -delete
# codesign -s "${{ secrets.CODESIGN_P12_NAME }}" --deep ./*.app
# === ARTIFACT ===
- name: "Zip artifact"
run: |
cd ./dist/
7z a ../${{ github.event.repository.name }}-${{ runner.os }}.zip .
- name: "Upload commit artifact"
if: "github.event_name != 'release'"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.event.repository.name }}-${{ runner.os }}-Artifact"
path: "./${{ github.event.repository.name }}-${{ runner.os }}.zip"
compression-level: 0
- name: "Upload release artifact"
if: "github.event_name == 'release'"
uses: "softprops/action-gh-release@v1"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
files: "./${{ github.event.repository.name }}-${{ runner.os }}.zip"
source:
name: "source"
runs-on: "ubuntu-latest"
if: "github.event_name != 'push' || contains(github.event.head_commit.message, '+ BUILD')"
steps:
# === SETUP ===
- name: "Set git to use lf"
run: |
git config --global core.autocrlf false
git config --global core.eol lf
# === PACKAGE ===
- name: "Clone repo"
uses: "actions/checkout@v4"
with:
path: "."
- name: "Mark as release"
if: "github.event_name == 'release'"
run: |
sed "s/release = False/release = True/g" ./main.py > ./main.py.new
rm ./main.py
mv ./main.py.new ./main.py
- name: "Mark build number"
if: "github.event_name != 'release'"
run: |
sed "s/build_number = 0/build_number = ${{ github.run_number }}/g" ./main.py > ./main.py.new
rm ./main.py
mv ./main.py.new ./main.py
- name: "Package"
run: |
python ./setup.py || true
mkdir ./dist/
cp -r ./extension/ ./dist/
cp -r ./modules/ ./dist/
cp -r ./resources/ ./dist/
cp ./LICENSE ./dist/
cp ./main.py ./dist/
cp ./main-debug.py ./dist/
cp ./requirements.txt ./dist/
# === ARTIFACT ===
- name: "Zip artifact"
run: |
cd ./dist/
7z a ../${{ github.event.repository.name }}-Source.zip .
- name: "Upload commit artifact"
if: "github.event_name != 'release'"
uses: "actions/upload-artifact@v4"
with:
name: "${{ github.event.repository.name }}-Source-Artifact"
path: "./${{ github.event.repository.name }}-Source.zip"
compression-level: 0
- name: "Upload release artifact"
if: "github.event_name == 'release'"
uses: "softprops/action-gh-release@v1"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
files: "./${{ github.event.repository.name }}-Source.zip"
release:
name: "release"
runs-on: "ubuntu-latest"
if: "github.event_name == 'release'"
needs:
- build
- source
steps:
- name: "Set git to use lf"
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: "Clone repo"
uses: "actions/checkout@v4"
with:
path: "."
- name: "Update release"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
python ./.github/workflow_data/release.py
- name: "Delete skipped workflow runs"
if: "github.event_name == 'release'"
uses: "Willy-JL/delete-skipped-workflow-runs@main"
with:
retain_days: 0
keep_minimum_runs: 0