GH action #1
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 | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: [ master ] | ||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
jobs: | ||
pre-build: | ||
name: pre-build | ||
runs-on: "ubuntu-latest" | ||
outputs: | ||
current_branch_tag: ${{steps.branch_name.outputs.current_branch_tag}} | ||
is_tag: ${{steps.branch_name.outputs.is_tag}} | ||
steps: | ||
- name: Get branch/tag name | ||
id: branch_name | ||
run: | | ||
echo "current_branch_tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | ||
[[ "${GITHUB_REF_TYPE}" == "tag" ]] && echo "is_tag=true" >> $GITHUB_OUTPUT || echo "is_tag=false" >> $GITHUB_OUTPUT | ||
- name: Echo pre_build | ||
run: | | ||
echo ${{ steps.branch_name.outputs.is_tag }} ${{ steps.branch_name.outputs.current_branch_tag }} | ||
echo ${{ github.ref}} | ||
build: | ||
name: ${{ matrix.config.os }}-build | ||
runs-on: ${{ matrix.config.os }} | ||
needs: [pre-build, build-web-app] | ||
Check failure on line 39 in .github/workflows/build-and-release.yml
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: "Windows", | ||
artifact: "AdvancedStorage.dll", | ||
artifactPath: "Release\\AdvancedStorage.dll", | ||
triplet: x64-windows, | ||
os: windows-latest, | ||
extraCMakeFlags: "" | ||
} | ||
- { | ||
name: "Ubuntu", | ||
artifact: "libAdvancedStorage.so", | ||
artifactPath: "libAdvancedStorage.so", | ||
triplet: x64-linux, | ||
os: ubuntu-latest, | ||
extraCMakeFlags: "" | ||
} | ||
- { | ||
name: "MacOSX", | ||
artifact: "libAdvancedStorage.dylib", | ||
artifactPath: "libAdvancedStorage.dylib", | ||
triplet: x64-osx, | ||
os: macos-13, | ||
extraCMakeFlags: "-DUSE_LEGACY_BOOST=ON" | ||
} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: show gitref / tags | ||
run: echo ${{ github.ref }} ${{needs.pre-build.outputs.current_branch_tag}} ${{needs.pre-build.outputs.is_tag}} | ||
- name: install Mercurial on MacOS | ||
if: runner.os == 'MacOS' | ||
run: pip3 install mercurial --break-system-packages | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build ${{matrix.config.extraCMakeFlags}} -DPLUGIN_VERSION="${{needs.pre-build.outputs.current_branch_tag}}" -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
env: | ||
MAKEFLAG: -j4 | ||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
env: | ||
MAKEFLAG: -j4 | ||
- name: Upload | ||
uses: actions/[email protected] | ||
with: | ||
path: ${{github.workspace}}/build/${{matrix.config.artifactPath}} | ||
name: ${{matrix.config.artifact}} | ||
if-no-files-found: error | ||
- name: Setup tmate session | ||
if: ${{ failure() }} | ||
uses: mxschmitt/action-tmate@v3 | ||
with: | ||
limit-access-to-actor: true | ||
timeout-minutes: 20 | ||
release: | ||
needs: [build, pre-build] | ||
if: needs.pre-build.outputs.is_tag == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create Release | ||
id: create_release | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag: ${{ needs.pre-build.outputs.current_branch_tag }} | ||
name: Release ${{ needs.pre-build.outputs.current_branch_tag }} | ||
draft: false | ||
prerelease: false | ||
- name: Store Release url | ||
run: | | ||
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url | ||
- name: Upload release url artifact | ||
uses: actions/[email protected] | ||
with: | ||
path: ./upload_url | ||
name: upload_url | ||
if-no-files-found: error | ||
publish: | ||
name: ${{ matrix.config.name }} | ||
needs: [pre-build, release] | ||
if: needs.pre-build.outputs.is_tag == 'true' | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: "Windows", | ||
artifact: "AdvancedStorage.dll", | ||
artifact_name: "AdvancedStorage-win64.dll", | ||
os: ubuntu-latest | ||
} | ||
- { | ||
name: "Ubuntu", | ||
artifact: "libAdvancedStorage.so", | ||
artifact_name: "libAdvancedStorage-ubuntu.so", | ||
os: ubuntu-latest | ||
} | ||
- { | ||
name: "MacOSX", | ||
artifact: "libAdvancedStorage.dylib", | ||
artifact_name: "libAdvancedStorage-universal.dylib", | ||
os: ubuntu-latest | ||
} | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ matrix.config.artifact }} | ||
path: ./ | ||
- name: Download URL | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: upload_url | ||
path: ./ | ||
- id: set_upload_url | ||
run: | | ||
upload_url=`cat ./upload_url` | ||
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT | ||
- name: Upload to Release | ||
id: upload_to_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.set_upload_url.outputs.upload_url }} | ||
asset_path: ./${{ matrix.config.artifact }} | ||
asset_name: ${{ matrix.config.artifact_name }} | ||
asset_content_type: application/octet-stream |