release #9 #272
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: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies (Ubuntu and macOS) | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
if [[ ${{ matrix.os }} == 'ubuntu-latest' ]]; then | ||
sudo apt-get update | ||
sudo apt-get install -y qt6-base-dev ninja-build cmake | ||
elif [[ ${{ matrix.os }} == 'macos-latest' ]]; then | ||
brew install qt ninja cmake | ||
fi | ||
- name: Install dependencies (Windows) | ||
if: matrix.os == 'windows-latest' | ||
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 "${{ github.workspace }}/build" \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-G "Ninja" \ | ||
-DCMAKE_PREFIX_PATH="$env:CMAKE_PREFIX_PATH" \ | ||
-S "${{ github.workspace }}" | ||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} | ||
Check failure on line 55 in .github/workflows/cmake-multi-platform.yml GitHub Actions / Build and Release Notepad--Invalid workflow file
|
||
- name: Build | ||
run: cmake --build "${{ github.workspace }}/build" --parallel | ||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} | ||
- name: Package application | ||
run: | | ||
if [[ ${{ matrix.os }} == 'ubuntu-latest' ]]; then | ||
tar -czf Notepad--.tar.gz -C "${{ github.workspace }}/build" . | ||
elif [[ ${{ matrix.os }} == 'macos-latest' ]]; then | ||
hdiutil create -volname Notepad-- -srcfolder "${{ github.workspace }}/build" -ov -format UDZO Notepad--.dmg | ||
elif [[ ${{ matrix.os }} == 'windows-latest' ]]; then | ||
powershell Compress-Archive -Path "${{ github.workspace }}\build\*" -DestinationPath "Notepad--.zip" | ||
fi | ||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}-artifact | ||
path: | | ||
Notepad--.tar.gz | ||
Notepad--.dmg | ||
Notepad--.zip | ||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build 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 release assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/ | ||
asset_name: ${{ matrix.os }}-Notepad--.tar.gz | ||
asset_name: ${{ matrix.os }}-Notepad--.dmg | ||
asset_name: ${{ matrix.os }}-Notepad--.zip | ||
content_type: application/octet-stream |