CMake #43
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: [workflow_dispatch] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
PACKAGE_NAME: nsca-fast | |
PACKAGE_VERSION: 2.9.1-4 | |
ARCH: amd64 | |
jobs: | |
create_release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }} | |
release_name: Binary release ${{ env.PACKAGE_NAME }} ${{ env.PACKAGE_VERSION }} | |
build_release: | |
name: Build release | |
needs: create_release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Dependecies ubuntu-latest | |
run: | | |
sudo apt-get -y -qq update | |
sudo apt-get -y -qq --no-install-recommends install \ | |
cmake \ | |
libmcrypt-dev \ | |
libevent-dev | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{runner.workspace}}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{runner.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE | |
- name: Build | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
run: cmake --build . --config $BUILD_TYPE | |
- name: Build dep and binary package | |
shell: bash | |
run: | | |
sudo apt-get -y -qq install fakeroot dh-make | |
bash .github/build-debian.sh | |
- name: get name of the artifact | |
run: | | |
ARTIFACT_PATHNAME_DEB=$(ls Release/*.deb|head -n1) | |
ARTIFACT_NAME_DEB=$(basename $ARTIFACT_PATHNAME_DEB) | |
ARTIFACT_PATHNAME_TAR=$(ls Release/*.tar.gz|head -n1) | |
ARTIFACT_NAME_TAR=$(basename $ARTIFACT_PATHNAME_TAR) | |
echo ARTIFACT_NAME_DEB=${ARTIFACT_NAME_DEB} >> $GITHUB_ENV | |
echo ARTIFACT_PATHNAME_DEB=${ARTIFACT_PATHNAME_DEB} >> $GITHUB_ENV | |
echo ARTIFACT_NAME_TAR=${ARTIFACT_NAME_TAR} >> $GITHUB_ENV | |
echo ARTIFACT_PATHNAME_TAR=${ARTIFACT_PATHNAME_TAR} >> $GITHUB_ENV | |
- name: Upload deb | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ env.ARTIFACT_PATHNAME_DEB }} | |
asset_name: ${{ env.ARTIFACT_NAME_DEB }} | |
asset_content_type: application/vnd.debian.binary-package | |
- name: Upload tar.gz | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ env.ARTIFACT_PATHNAME_TAR }} | |
asset_name: ${{ env.ARTIFACT_NAME_TAR }} | |
asset_content_type: application/gzip | |