Skip to content

Commit

Permalink
[ci] build and deploy github releases on tagged commits
Browse files Browse the repository at this point in the history
  • Loading branch information
vovkos committed Oct 18, 2021
1 parent 025e9cd commit e72a927
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 7 deletions.
88 changes: 81 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- 3.4.2
- 8.0.0

env:
RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && matrix.CONFIGURATION == 'Release' }}

defaults:
run:
shell: cmd
Expand Down Expand Up @@ -72,6 +75,29 @@ jobs:
cmake --build . %CMAKE_BUILD_FLAGS% || exit
ctest --output-on-failure -C %CONFIGURATION% || exit
- name: Package
id: PACKAGE
if: ${{ env.RELEASE == 'true' }}
run: |
set THIS_DIR=%CD%
set THIS_DIR_CMAKE=%THIS_DIR:\=/%
cd build
cpack -G 7Z -C Release
for /f "usebackq tokens=*" %%i in (`cmake -P print-package-file-name.cmake 2^>^&1`) do (set CPACK_PACKAGE_FILE_NAME=%%i)
set DEPLOY_FILE=build/%CPACK_PACKAGE_FILE_NAME%.7z
echo ::set-output name=DEPLOY_FILE::%DEPLOY_FILE%
- name: Deploy to GitHub Releases
uses: softprops/action-gh-release@v1
if: ${{ env.RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ${{steps.PACKAGE.outputs.DEPLOY_FILE}}

linuxBuild:
name: Linux Build
runs-on: ubuntu-18.04
Expand All @@ -92,6 +118,7 @@ jobs:
- clang

env:
RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && matrix.CONFIGURATION == 'Release' && matrix.COMPILER == 'gcc' }}
DEPLOY_BINARIES: ${{ github.ref == 'refs/heads/master' && matrix.CONFIGURATION == 'Release' && matrix.COMPILER == 'gcc' }}
BUILD_DOC: ${{ github.ref == 'refs/heads/master' && matrix.CONFIGURATION == 'Release' && matrix.TARGET_CPU == 'amd64' && matrix.COMPILER == 'gcc' }}

Expand Down Expand Up @@ -139,13 +166,6 @@ jobs:
ctest --output-on-failure
popd
- name: Build and deploy binary package
if: ${{ env.DEPLOY_BINARIES == 'true' }}
env:
JANCY_PACKAGE_ID_RSA: ${{secrets.JANCY_PACKAGE_ID_RSA}}
run: |
source ci/github-actions/deploy-package.sh linux-${{matrix.TARGET_CPU}}
- name: Build documentation tools
if: ${{ env.BUILD_DOC == 'true' }}
run: |
Expand Down Expand Up @@ -182,6 +202,29 @@ jobs:
touch html/.nojekyll
popd
- name: Package
id: PACKAGE
if: ${{ env.RELEASE == 'true' }}
run: |
set THIS_DIR=%CD%
set THIS_DIR_CMAKE=%THIS_DIR:\=/%
cd build
cpack -G TXZ
CPACK_PACKAGE_FILE_NAME=$(cmake -P print-package-file-name.cmake)
DEPLOY_FILE=build/%CPACK_PACKAGE_FILE_NAME.tar.xz
echo ::set-output name=DEPLOY_FILE::$DEPLOY_FILE
- name: Deploy to GitHub Releases
if: ${{ env.RELEASE == 'true' }}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ${{steps.PACKAGE.outputs.DEPLOY_FILE}}

- name: Deploy to GitHub pages
if: ${{ env.BUILD_DOC == 'true' }}
uses: peaceiris/actions-gh-pages@v3
Expand All @@ -190,6 +233,13 @@ jobs:
publish_dir: build/doc/html
force_orphan: true

- name: Build and deploy binary package
if: ${{ env.DEPLOY_BINARIES == 'true' }}
env:
JANCY_PACKAGE_ID_RSA: ${{secrets.JANCY_PACKAGE_ID_RSA}}
run: |
source ci/github-actions/deploy-package.sh linux-${{matrix.TARGET_CPU}}
macOsBuild:
name: macOS Build
runs-on: macos-10.15
Expand All @@ -202,6 +252,7 @@ jobs:
- Release

env:
RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && matrix.CONFIGURATION == 'Release' }}
DEPLOY_BINARIES: ${{ github.ref == 'refs/heads/master' && matrix.CONFIGURATION == 'Release' }}

defaults:
Expand Down Expand Up @@ -246,6 +297,29 @@ jobs:
ctest --output-on-failure
popd
- name: Package
id: PACKAGE
if: ${{ env.RELEASE == 'true' }}
run: |
set THIS_DIR=%CD%
set THIS_DIR_CMAKE=%THIS_DIR:\=/%
cd build
cpack -G TXZ
CPACK_PACKAGE_FILE_NAME=$(cmake -P print-package-file-name.cmake)
DEPLOY_FILE=build/%CPACK_PACKAGE_FILE_NAME.tar.xz
echo ::set-output name=DEPLOY_FILE::$DEPLOY_FILE
- name: Deploy to GitHub Releases
if: ${{ env.RELEASE == 'true' }}
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ${{steps.PACKAGE.outputs.DEPLOY_FILE}}

- name: Build and deploy binary package
if: ${{ env.DEPLOY_BINARIES == 'true' }}
env:
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,10 @@ endif()

include(CPack)

configure_file(
${CMAKE_CURRENT_LIST_DIR}/ci/github-actions/print-package-file-name.cmake
${CMAKE_CURRENT_BINARY_DIR}/print-package-file-name.cmake
COPYONLY
)

#...............................................................................
13 changes: 13 additions & 0 deletions ci/github-actions/print-package-file-name.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#...............................................................................
#
# This file is part of the Doxyrest toolkit.
#
# Doxyrest is distributed under the MIT license.
# For details see accompanying license.txt file,
# the public copy of which is also available at:
# http://tibbo.com/downloads/archive/doxyrest/license.txt
#
#...............................................................................

include(CPackConfig.cmake)
message(${CPACK_PACKAGE_FILE_NAME})

0 comments on commit e72a927

Please sign in to comment.