Skip to content

Merge branch 'master' into find-refactoring #489

Merge branch 'master' into find-refactoring

Merge branch 'master' into find-refactoring #489

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-web-app:
name: build-web-app
runs-on: "ubuntu-latest"
needs: [pre-build]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '19'
- name: show gitref / tags
run: echo ${{ github.ref }} ${{needs.pre-build.outputs.current_branch_tag}} ${{needs.pre-build.outputs.is_tag}}
- run: npm install
working-directory: WebApplication
- run: npm run build
working-directory: WebApplication
- name: upload web-app-dist to s3
working-directory: WebApplication
run: zip -r ${{needs.pre-build.outputs.current_branch_tag}}.zip dist/ && aws s3 --region eu-west-1 cp ${{needs.pre-build.outputs.current_branch_tag}}.zip s3://public-files.orthanc.team/oe2-dist-files/ --cache-control max-age=1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- uses: actions/upload-artifact@v3
with:
name: web-app-dist
path: WebApplication/dist/
build:
name: ${{ matrix.config.os }}-build
runs-on: ${{ matrix.config.os }}
needs: [pre-build, build-web-app]
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
artifact: "OrthancExplorer2.dll",
artifactPath: "Release\\OrthancExplorer2.dll",
triplet: x64-windows,
os: windows-latest,
extraCMakeFlags: ""
}
- {
name: "Ubuntu",
artifact: "libOrthancExplorer2.so",
artifactPath: "libOrthancExplorer2.so",
triplet: x64-linux,
os: ubuntu-latest,
extraCMakeFlags: ""
}
- {
name: "MacOSX",
artifact: "libOrthancExplorer2.dylib",
artifactPath: "libOrthancExplorer2.dylib",
triplet: x64-osx,
os: macos-13,
extraCMakeFlags: "-DUSE_LEGACY_BOOST=ON"
}
steps:
- uses: actions/checkout@v3
- name: show gitref / tags
run: echo ${{ github.ref }} ${{needs.pre-build.outputs.current_branch_tag}} ${{needs.pre-build.outputs.is_tag}}
- uses: actions/[email protected]
id: download
with:
name: web-app-dist
path: WebApplication/dist
- 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}} -DWEBAPP_DIST_SOURCE=WEB
env:
MAKEFLAG: -j4
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
env:
MAKEFLAG: -j4
- name: Upload
uses: actions/upload-artifact@v3
with:
path: ${{github.workspace}}/build/${{matrix.config.artifactPath}}
name: ${{matrix.config.artifact}}
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
timeout-minutes: 20
check-translations:
name: check-translations
runs-on: "ubuntu-latest"
needs: [pre-build]
steps:
- uses: actions/checkout@v3
- run: python3 ./scripts/check-translations.py
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
- uses: actions/upload-artifact@v3
with:
path: ./upload_url
name: upload_url
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: "OrthancExplorer2.dll",
artifact_name: "OrthancExplorer2-win64.dll",
os: ubuntu-latest
}
- {
name: "Ubuntu",
artifact: "libOrthancExplorer2.so",
artifact_name: "libOrthancExplorer2-ubuntu.so",
os: ubuntu-latest
}
- {
name: "MacOSX",
artifact: "libOrthancExplorer2.dylib",
artifact_name: "libOrthancExplorer2-universal.dylib",
os: ubuntu-latest
}
steps:
- name: Download artifact
uses: actions/[email protected]
with:
name: ${{ matrix.config.artifact }}
path: ./
- name: Download URL
uses: actions/[email protected]
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