Build #57
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [ "*" ] | |
| pull_request: | |
| branches: [ "*" ] | |
| workflow_dispatch: | |
| inputs: | |
| make_a_release: | |
| description: "Make a release" | |
| type: boolean | |
| required: false | |
| default: false | |
| schedule: | |
| # Runs every 7 days | |
| - cron: '0 0 */7 * *' | |
| env: | |
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.friendly_name }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| friendly_name: "Linux (Ubuntu)" | |
| - os: macos-latest | |
| platform: macos | |
| friendly_name: "macOS" | |
| - os: windows-latest | |
| platform: windows | |
| friendly_name: "Windows" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Export GitHub Actions cache environment variables | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| - name: Force VCPKG_BUILD_TYPE to release | |
| shell: bash | |
| run: | | |
| find ./vcpkg/triplets -type f -exec sh -c "echo 'set(VCPKG_BUILD_TYPE release)' >> \"\$1\"" _ {} \; | |
| - name: Read version from version.txt | |
| shell: bash | |
| run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
| - name: Replace <VERSION> in platform files | |
| shell: bash | |
| run: | | |
| if [[ "$OSTYPE" == "darwin"* ]]; then | |
| SED_INPLACE="sed -i ''" | |
| else | |
| SED_INPLACE="sed -i" | |
| fi | |
| $SED_INPLACE "s/<VERSION>/${{ env.VERSION }}/g" platform/linux/orientview.desktop | |
| $SED_INPLACE "s/<VERSION>/${{ env.VERSION }}/g" platform/macos/Info.plist | |
| $SED_INPLACE "s/<VERSION>/${{ env.VERSION }}/g" platform/windows/orientview.rc | |
| - name: Install Linux build dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y nasm bison rpm libxi-dev libxtst-dev '^libxcb.*-dev' libx11-xcb-dev libgl1-mesa-dev libxrender-dev libxkbcommon-dev libxkbcommon-x11-dev libltdl-dev | |
| - name: Configure and Build | |
| run: | | |
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build --config Release | |
| - name: Run CPack generators | |
| shell: bash | |
| working-directory: build | |
| run: | | |
| if [[ "${{ matrix.platform }}" == "windows" ]]; then | |
| cpack -G NSIS | |
| cpack -G ZIP | |
| elif [[ "${{ matrix.platform }}" == "linux" ]]; then | |
| cpack -G DEB | |
| cpack -G RPM | |
| cpack -G TGZ | |
| elif [[ "${{ matrix.platform }}" == "macos" ]]; then | |
| cpack -G DragNDrop | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "${{ matrix.platform }}-binaries" | |
| path: | | |
| build/*.zip | |
| build/*.deb | |
| build/*.rpm | |
| build/*.dmg | |
| build/*.exe | |
| build/*.tar.gz | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event.inputs.make_a_release == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Flatten artifact directory | |
| run: | | |
| mkdir release-files | |
| find artifacts -type f -exec cp {} release-files/ \; | |
| - name: Read version from version.txt | |
| run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: "OrientView v${{ env.VERSION }}" | |
| files: release-files/* | |
| generate_release_notes: true | |
| make_latest: true |