Skip to content

Build & Release Millennium #11

Build & Release Millennium

Build & Release Millennium #11

Workflow file for this run

name: Build Millennium
on:
workflow_dispatch:
jobs:
build-windows:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: windows-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: (Setup) Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: (Setup) Assets Build Environment
run: cd assets && npm install && npm run dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (Setup) Build Assets
run: . scripts\ci\win32\mk-assets.ps1
- name: (Setup) Construct Python Environment
run: . scripts\ci\win32\setup-python.ps1 D:/a/env/ext/data/cache
- name: (Setup) Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# dry run to get the next version
- name: Bump Version
id: read_version
run: . scripts\ci\win32\bump-version.ps1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up cache for Python source
uses: actions/cache@v3
id: build-cache
with:
path: Python-3.11.8/PCbuild/win32
key: ${{ runner.os }}-python-3.11.8-build
restore-keys: ${{ runner.os }}-python-3.11.8-build-
- name: (Python) Add msbuild to PATH
if: steps.build-cache.outputs.cache-hit != 'true'
uses: microsoft/setup-msbuild@v2
- name: (Python) Download 3.11.8 win32 source
if: steps.build-cache.outputs.cache-hit != 'true'
run: . scripts\ci\win32\build-python.ps1
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: python 3.11.8 build libraries
path: D:/a/Millennium/Millennium/build/python
- name: Install prerequisites
uses: msys2/setup-msys2@v2
with:
msystem: mingw32
install: >-
mingw-w64-i686-libgcrypt
mingw-w64-i686-gcc
mingw-w64-i686-cmake
mingw-w64-i686-ninja
- name: (Dependency) Install vcpkg
shell: pwsh
run: ./vendor/vcpkg/bootstrap-vcpkg.bat && ./vendor/vcpkg/vcpkg integrate install
- name: (Generator) Configure CMake
shell: msys2 {0}
run: cmake --preset=windows-mingw-release -DGITHUB_ACTION_BUILD=ON
- name: Build Millennium
shell: msys2 {0}
run: |
mkdir D:/a/Millennium/Millennium/build/artifacts
cmake --build build --config Release
cp D:/a/Millennium/Millennium/Python-3.11.8/PCbuild/win32/python311.dll D:/a/env/python311.dll
cp /d/a/Millennium/Millennium/build/user32.dll D:/a/env/user32.dll
mkdir D:/a/env/ext/bin
cp /d/a/Millennium/Millennium/build/cli/millennium.exe D:/a/env/ext/bin/millennium.exe
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: millennium-windows
path: D:/a/env/
build-linux:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: (Setup) Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: (Setup) Assets Build Environment
run: cd assets && npm install && npm run dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (Setup) Build Assets
run: bash scripts/ci/posix/mk-assets.sh
- name: (Setup) Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# dry run to get the next version
- name: Bump Version
id: read_version
run: bash scripts/ci/posix/bump-version.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install pyenv
run: |
curl https://pyenv.run | bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv install 3.11.8
pyenv global 3.11.8
python --version
shell: bash
- name: Verify Python version
run: python --version
- name: (Setup) Construct Python Environment
run: bash scripts/ci/posix/setup-python.sh /home/runner/env/ext/data/cache
- name: (Generator) Install CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.21.1'
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: (Dependency) Install vcpkg & setup environment
run: sudo apt install libgtk-3-dev ninja-build && ./vendor/vcpkg/bootstrap-vcpkg.sh && ./vendor/vcpkg/vcpkg integrate install
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: (Generator) Configure CMake
run: cmake --preset=linux -G "Ninja" -DGITHUB_ACTION_BUILD=ON
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: Build Millennium
run: |
mkdir ./build/artifacts
cmake --build build
cp ./build/user32 ./build/artifacts/user32
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: Build Millennium
run: |
mkdir -p /home/runner/Millennium/build/artifacts
cmake --build build --config Release
ls -laR /home/runner/Millennium/build
mkdir -p /home/runner/env
cp ./build/user32 /home/runner/env/user32
mkdir -p /home/runner/env/ext/bin
cp ./build/cli/millennium /home/runner/env/ext/bin/millennium
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: millennium-linux
path: /home/runner/env/
release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: millennium-windows
path: ./artifacts/windows
- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: millennium-linux
path: ./artifacts/linux
- name: Bump Version
id: read_version
run: bash scripts/ci/posix/bump-version.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Proccess Artifacts
run: |
# rename artifacts
ls -laR ./artifacts
mv ./artifacts/windows/millennium-windows.zip ./artifacts/windows/millennium-v${{ steps.read_version.outputs.version }}-windows-x86_64.zip
mv ./artifacts/linux/millennium-linux.zip ./artifacts/linux/millennium-v${{ steps.read_version.outputs.version }}-linux-x86_64.zip
- name: Create GitHub Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}