[ci] Add release to workflow(8). #71
Workflow file for this run
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
name: Switchres CIv2 | |
on: [push, pull_request] | |
jobs: | |
buildx86_64: | |
runs-on: ubuntu-latest | |
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} | |
strategy: | |
matrix: | |
platform: | |
- { name: linux_gcc } | |
- { name: windows_mingw, make_opts: PLATFORM=NT CROSS_COMPILE=x86_64-w64-mingw32- } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Linux dependencies | |
if: matrix.platform.name == 'linux_gcc' | |
run: sudo apt-get install libxrandr-dev libdrm-dev libsdl2-dev | |
- name: Install Windows dependencies | |
if: matrix.platform.name == 'windows_mingw' | |
run: | | |
sudo apt-get install mingw-w64 wget tar | |
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix | |
wget https://github.com/libsdl-org/SDL/releases/download/release-2.26.2/SDL2-devel-2.26.2-mingw.tar.gz | |
tar xvzf SDL2-devel-2.26.2-mingw.tar.gz | |
sudo make -C SDL2-2.26.2 CROSS_PATH=/usr ARCHITECTURES=x86_64-w64-mingw32 cross | |
wget https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-devel-2.20.1-mingw.tar.gz | |
tar xvzf SDL2_ttf-devel-2.20.1-mingw.tar.gz | |
sudo make -C SDL2_ttf-2.20.1 CROSS_PATH=/usr ARCHITECTURES=x86_64-w64-mingw32 cross | |
- name: Build libs and binary | |
run: | | |
make libswitchres ${{matrix.platform.make_opts}} | |
make ${{matrix.platform.make_opts}} | |
- name: Build grid.exe (Windows only) | |
if: matrix.platform.name == 'windows_mingw' | |
run: | | |
make ${{matrix.platform.make_opts}} clean | |
make ${{matrix.platform.make_opts}} grid | |
- name: Prepare artifacts | |
run: mkdir artifacts && cp -v libswitchres.{so,a,dll,lib} switchres{,.exe,.ini} grid{,.exe} /usr/x86_64-w64-mingw32/bin/SDL2{,_ttf}.dll /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll artifacts/ || true | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: switchres-${{matrix.platform.name}}-x86_64 | |
path: artifacts/ | |
win32-build-x86_64-geometry: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build geometry.exe | |
run: | | |
pip install pyinstaller | |
pyinstaller --onefile geometry.py --icon=tv.ico | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: geometry-win32-x86_64 | |
path: dist/ | |
release: | |
runs-on: ubuntu-latest | |
needs: [buildx86_64, win32-build-x86_64-geometry] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Get version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: Download artifacts | |
uses: actions/[email protected] | |
- name: Make packages | |
run: | | |
tag="${GITHUB_REF#refs/tags/}" | |
mv ./geometry-win32-x86_64/geometry.exe ./switchres-windows_mingw-x86_64 | |
7z a "switchres-${tag}-windows_mingw-x86_64.7z" ./switchres-windows_mingw-x86_64 | |
tar cvjf switchres-${tag}-linux_gcc-x86_64.tar.bz2 ./switchres-linux_gcc-x86_64 | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: Switchres ${{ steps.get_version.outputs.VERSION }} | |
draft: true | |
prerelease: false | |
files: | | |
./*.bz2 | |
./*.7z |