release #15 #278
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 Notepad-- | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies (Ubuntu) | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qt6-base-dev ninja-build cmake | ||
- name: Install dependencies (macOS) | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install qt ninja cmake | ||
- name: Install dependencies (Windows) | ||
if: ${{ runner.os == 'Windows' }} | ||
run: | | ||
choco install qt --version=6.5.3 -y | ||
choco install ninja -y | ||
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | ||
$QtPath = (Get-ChildItem -Directory 'C:\Qt\6.5.3' | Where-Object { $_.Name -match 'mingw.*' }).FullName | ||
if (-not $QtPath) { | ||
Write-Error "Could not find a valid Qt installation for MinGW." | ||
exit 1 | ||
} | ||
Write-Host "Using Qt path: $QtPath" | ||
$env:CMAKE_PREFIX_PATH = "$QtPath\lib\cmake" | ||
shell: pwsh | ||
- name: Configure CMake | ||
run: | | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Ninja" -S . | ||
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} | ||
Check failure on line 52 in .github/workflows/cmake-multi-platform.yml GitHub Actions / Build and Release Notepad--Invalid workflow file
|
||
- name: Build application | ||
run: cmake --build build --parallel | ||
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }} | ||
- name: Package application | ||
run: | | ||
if [[ $RUNNER_OS == "Linux" ]]; then | ||
tar -czf Notepad--_linux.tar.gz -C build . | ||
elif [[ $RUNNER_OS == "macOS" ]]; then | ||
hdiutil create -volname Notepad-- -srcfolder build -ov -format UDZO Notepad--_macos.dmg | ||
elif [[ $RUNNER_OS == "Windows" ]]; then | ||
Compress-Archive -Path build\* -DestinationPath Notepad--_windows.zip | ||
fi | ||
shell: bash | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }}-artifact | ||
path: | | ||
Notepad--_linux.tar.gz | ||
Notepad--_macos.dmg | ||
Notepad--_windows.zip | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ./artifacts | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.run_id }} | ||
release_name: Release ${{ github.run_id }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Linux release asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/Notepad--_linux.tar.gz | ||
asset_name: Notepad--_linux.tar.gz | ||
content_type: application/gzip | ||
- name: Upload macOS release asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/Notepad--_macos.dmg | ||
asset_name: Notepad--_macos.dmg | ||
content_type: application/octet-stream | ||
- name: Upload Windows release asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/Notepad--_windows.zip | ||
asset_name: Notepad--_windows.zip | ||
content_type: application/zip |