release #51 #316
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: Build and Release | |
on: | |
push: | |
branches: [main, dev] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-and-release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
artifact_extension: tar.gz | |
- os: macos-latest | |
artifact_extension: zip | |
- os: windows-latest | |
artifact_extension: zip | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Ubuntu Section | |
- name: Install dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build \ | |
qt6-base-dev qt6-tools-dev qt6-tools-dev-tools \ | |
qt6-l10n-tools libgl1-mesa-dev libglu1-mesa-dev rsync | |
- name: Configure CMake (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cmake -B "${{ github.workspace }}/build" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-G "Ninja" \ | |
-S "${{ github.workspace }}" | |
- name: Build Notepad-- (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: cmake --build "${{ github.workspace }}/build" --config Release | |
- name: Package Notepad-- (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
BUILD_DIR="${{ github.workspace }}/build" | |
TEMP_DIR="/tmp/build_copy" | |
rm -rf $TEMP_DIR | |
rsync -a "$BUILD_DIR/" "$TEMP_DIR/" | |
cd $TEMP_DIR | |
tar -czvf Notepad--.tar.gz ./* | |
# macOS Section | |
- name: Install dependencies (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install ninja qt | |
- name: Configure CMake (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
cmake -B "${{ github.workspace }}/build" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-G "Ninja" \ | |
-S "${{ github.workspace }}" | |
- name: Build Notepad-- (macOS) | |
if: matrix.os == 'macos-latest' | |
run: cmake --build "${{ github.workspace }}/build" --config Release | |
- name: Package Notepad-- (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
cd "${{ github.workspace }}/build" | |
hdiutil create -volname Notepad-- -srcfolder . -ov -format UDZO Notepad--.dmg | |
zip Notepad--.zip Notepad--.dmg | |
# Windows Section | |
- name: Install dependencies (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
choco install ninja -y | |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
choco install visualstudio2022buildtools -y --install-arguments \ | |
'--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --norestart' | |
shell: cmd | |
- name: Install Qt (Windows) | |
if: matrix.os == 'windows-latest' | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: '6.5.3' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2019_64' | |
- name: Configure CMake (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
call "${{ env.QT_ROOT_DIR }}\\bin\\qt-cmake.bat" ^ | |
-B "${{ github.workspace }}\\build" ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-G Ninja ^ | |
-S "${{ github.workspace }}" | |
shell: cmd | |
- name: Build Notepad-- (Windows) | |
if: matrix.os == 'windows-latest' | |
run: cmake --build "${{ github.workspace }}\\build" --config Release | |
- name: Package Notepad-- (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd "${{ github.workspace }}\\build" | |
Compress-Archive -Path . -DestinationPath Notepad--.zip | |
# Upload Artifacts | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Notepad---${{ matrix.os }} | |
path: | | |
${{ github.workspace }}/build/Notepad--.${{ matrix.artifact_extension }} | |
/tmp/build_copy/Notepad--.tar.gz |