release #12 #275
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 | ||
# Install dependencies | ||
- name: Install dependencies on Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qt6-base-dev ninja-build cmake | ||
- name: Install dependencies on macOS | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
brew install qt ninja cmake | ||
- name: Install dependencies on 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 | ||
# Configure CMake | ||
- name: Configure CMake | ||
run: | | ||
cmake -B "${{ github.workspace }}/build" \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-G "Ninja" \ | ||
-S "${{ github.workspace }}" | ||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} | ||
Check failure on line 58 in .github/workflows/cmake-multi-platform.yml GitHub Actions / Build and Release Notepad--Invalid workflow file
|
||
# Build | ||
- name: Build | ||
run: | | ||
cmake --build "${{ github.workspace }}/build" --parallel | ||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }} | ||
# Package the application | ||
- name: Package application on Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
tar -czf Notepad--.tar.gz -C "${{ github.workspace }}/build" . | ||
shell: bash | ||
- name: Package application on macOS | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
hdiutil create -volname Notepad-- -srcfolder "${{ github.workspace }}/build" -ov -format UDZO Notepad--.dmg | ||
shell: bash | ||
- name: Package application on Windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
Compress-Archive -Path "${{ github.workspace }}\build\*" -DestinationPath "Notepad--.zip" | ||
shell: pwsh | ||
# Upload artifacts | ||
- 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: Notepad--_${{ matrix.os }}.tar.gz | ||
asset_name: Notepad--_${{ matrix.os }}.dmg | ||
asset_name: Notepad--_${{ matrix.os }}.zip | ||
content_type: application/octet-stream |