Run the release build for every push. #37
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
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| name: Create release | |
| jobs: | |
| build_linux: | |
| name: Build Linux ${{matrix.architecture}} static | |
| container: | |
| image: ubuntu:20.04 | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| architecture: [ x64 ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install tools | |
| run: ./.github/build/linux-${{matrix.architecture}}/install.sh | |
| - name: Clone dependencies | |
| run: ./clone-dependencies.sh | |
| - name: Build | |
| run: ./.github/build/linux-${{matrix.architecture}}/build.sh | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir -p /artifacts | |
| cp -r /dependencies/lib /artifacts | |
| cp -r /dependencies/include /artifacts | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-${{matrix.architecture}}-static | |
| path: /artifacts | |
| build_windows: | |
| name: Build Windows ${{matrix.architecture}} ${{matrix.buildType}} ${{matrix.openmp}} ${{matrix.all == true && 'all' || ''}} ${{matrix.linkRuntime == true && 'linked runtime' || ''}} | |
| runs-on: windows-2022 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| architecture: [ x64, arm64, x86 ] | |
| buildType: [ dynamic, static ] | |
| openmp: [ OpenMP, noOpenMP ] | |
| all: [ false, true ] | |
| linkRuntime: [ false, true ] | |
| exclude: | |
| - buildType: dynamic | |
| linkRuntime: true | |
| - all: true | |
| linkRuntime: true | |
| env: | |
| ARTIFACT_NAME: windows-${{matrix.architecture}}-${{matrix.buildType}}-${{matrix.openmp}}${{matrix.all == true && '-all' || ''}}${{matrix.linkRuntime == true && '-linked-runtime' || ''}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download configure | |
| shell: cmd | |
| run: | | |
| .github\build\windows\download-configure.cmd | |
| - name: Clone dependencies | |
| shell: cmd | |
| run: clone-dependencies.cmd | |
| - name: Run configure | |
| shell: cmd | |
| working-directory: Configure | |
| run: | | |
| Configure.Release.x64.exe /noWizard /VS2022 /${{matrix.architecture}} /${{matrix.buildType}} /${{matrix.openmp}} ${{matrix.all == true && '/includeOptional /incompatibleLicense' || ''}} ${{matrix.linkRuntime == true && '/linkRuntime' || ''}} | |
| - name: Build | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" | |
| msbuild IM7.${{matrix.buildType}}.${{matrix.architecture}}.sln /m /t:Rebuild /p:Configuration=Release,Platform=${{matrix.architecture}} | |
| - name: Prepare artifacts | |
| shell: cmd | |
| run: | | |
| del "Artifacts\bin\*.pdb" /Q 2>nul | |
| del "Artifacts\lib\*.pdb" /Q 2>nul | |
| for %%F in ("Artifacts\lib\*.lib") do ( | |
| echo %%~nxF >> "Artifacts\pre-build-libs.txt" | |
| ) | |
| powershell -Command "Compress-Archive -Path 'Artifacts\*' -DestinationPath '${{ env.ARTIFACT_NAME }}.zip'" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARTIFACT_NAME }} | |
| path: ${{ env.ARTIFACT_NAME }}.zip | |
| release: | |
| name: Create release | |
| if: github.event_name == 'workflow_dispatch' | |
| runs-on: windows-2022 | |
| needs: build_windows | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| name: Download executables | |
| with: | |
| path: ${{ github.workspace }}/Artifacts | |
| merge-multiple: true | |
| - name: Set release number | |
| shell: bash | |
| run: echo "release=$(date +'%Y.%m.%d.%H%M')" >> $GITHUB_ENV | |
| - name: Create and push tag | |
| shell: bash | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag $release | |
| git push origin $release | |
| - name: Publish release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ env.release }} | |
| tag_name: ${{ env.release }} | |
| files: | | |
| ${{ github.workspace }}/Artifacts/*.zip |