CMake on multiple platforms #15
Workflow file for this run
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: CMake on multiple platforms | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- windows-2022 | |
- macos-12 | |
- macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
echo "platform=${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_OUTPUT" | |
echo "artifact=${{ github.workspace }}/build/${{ runner.os }}-${{ runner.arch }}.tar.gz" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: cmake -B ${{ steps.strings.outputs.build-output-dir }} -S ${{ github.workspace }} | |
- name: Build | |
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release | |
- name: Install GNU tar for macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install gnu-tar | |
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH | |
- name: Pack artifact for ${{ matrix.os }} (${{ steps.strings.outputs.platform }}) | |
if: runner.os != 'Windows' | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }} | |
tar -czvf ${{ steps.strings.outputs.artifact }} JxrDecApp JxrEncApp | |
- name: Pack artifact (windows) ${{ matrix.os }} (${{ steps.strings.outputs.platform }}) | |
if: runner.os == 'Windows' | |
run: | | |
cd ${{ steps.strings.outputs.build-output-dir }}/Release | |
tar -czvf ${{ steps.strings.outputs.artifact }} JxrDecApp.exe JxrEncApp.exe | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.strings.outputs.platform }} | |
path: ${{ steps.strings.outputs.artifact }} | |
release-binaries: | |
runs-on: ubuntu-20.04 | |
needs: [ build ] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/build | |
merge-multiple: true | |
- name: Publish | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ${{ github.workspace }}/build/*.tar.gz |