1
0
mirror of https://github.com/rtbrick/bngblaster.git synced 2024-05-06 15:54:57 +00:00

109 lines
3.3 KiB
YAML
Raw Normal View History

2021-02-05 00:10:54 +01:00
name: Release
on:
push:
tags:
2021-02-05 16:00:09 +01:00
- "[0-9]+.[0-9]+.[0-9]+"
2021-02-05 00:10:54 +01:00
2021-06-18 10:10:19 +02:00
env:
BUILD_TYPE: Release
2021-02-05 00:10:54 +01:00
jobs:
2021-02-05 16:00:09 +01:00
release:
name: Create Release
2021-02-05 16:06:35 +01:00
runs-on: ubuntu-latest
2021-02-05 16:00:09 +01:00
steps:
2021-02-05 16:06:35 +01:00
- name: Get Ref Names
id: ref_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
2021-02-05 16:00:09 +01:00
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2021-02-05 16:06:35 +01:00
tag_name: ${{ steps.ref_name.outputs.SOURCE_TAG }}
release_name: ${{ steps.ref_name.outputs.SOURCE_TAG }}
body: RtBrick BNG Blaster Version ${{ steps.ref_name.outputs.SOURCE_TAG }}
2021-02-05 16:00:09 +01:00
2021-02-05 00:10:54 +01:00
build:
2021-02-05 16:06:35 +01:00
name: Build Release ${{matrix.os}}
2021-02-05 16:00:09 +01:00
needs: [release]
2021-02-09 22:38:06 +01:00
runs-on: ${{matrix.os}}
2021-02-05 16:00:09 +01:00
strategy:
matrix:
2022-05-25 15:23:21 +00:00
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04]
2021-02-05 00:10:54 +01:00
steps:
2022-10-14 18:59:49 +02:00
- uses: actions/checkout@v3
2021-05-26 19:39:12 +02:00
2021-02-05 16:06:35 +01:00
- name: Get Ref Names
id: ref_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
2021-02-05 16:00:09 +01:00
- name: Download RtBrick libdict
2021-02-05 00:10:54 +01:00
shell: bash
run: wget https://github.com/rtbrick/libdict/releases/download/v1.0.1/libdict-debian.zip
2021-05-26 19:39:12 +02:00
2021-02-05 16:00:09 +01:00
- name: Install RtBrick libdict
2021-02-05 00:10:54 +01:00
shell: bash
run: unzip libdict-debian.zip; sudo dpkg -i libdict_1.0.1_amd64.deb; sudo dpkg -i libdict-dev_1.0.1_amd64.deb
2021-05-26 19:39:12 +02:00
2021-02-05 16:00:09 +01:00
- name: Install Dependencies
2021-02-05 00:10:54 +01:00
shell: bash
2021-02-05 16:00:09 +01:00
run: sudo apt install -y libcunit1-dev libncurses5-dev libssl-dev libjansson-dev libcmocka-dev libpcap-dev
2021-02-05 00:10:54 +01:00
2021-05-26 19:39:12 +02:00
- name: Set export SOURCE_DATE_EPOCH to git commit time
run: |
echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> $GITHUB_ENV
2021-02-05 00:10:54 +01:00
- name: Create Build Environment
2021-02-05 16:06:35 +01:00
run: cmake -E make_directory ${{ github.workspace }}/build
2021-02-05 00:10:54 +01:00
- name: Configure CMake
shell: bash
2021-02-05 16:06:35 +01:00
working-directory: ${{ github.workspace }}/build
run: cmake $GITHUB_WORKSPACE -DBNGBLASTER_VERSION=${{ steps.ref_name.outputs.SOURCE_TAG }} -DBNGBLASTER_TESTS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE
2021-02-05 00:10:54 +01:00
- name: Build
2021-02-05 16:06:35 +01:00
working-directory: ${{ github.workspace }}/build
2021-02-05 00:10:54 +01:00
shell: bash
run: cmake --build . --config $BUILD_TYPE
- name: Test
2021-02-05 16:06:35 +01:00
working-directory: ${{ github.workspace }}/build
2021-02-05 00:10:54 +01:00
shell: bash
run: ctest -C $BUILD_TYPE
- name: Package
working-directory: ${{github.workspace}}/build
shell: bash
2021-02-05 16:00:09 +01:00
run: cpack -G DEB
2021-02-05 00:10:54 +01:00
2021-02-05 16:00:09 +01:00
- name: Get Release
2021-02-05 16:06:35 +01:00
id: get_release
uses: leahlundqvist/get-release@v1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-02-05 00:10:54 +01:00
with:
2021-02-05 16:06:35 +01:00
tag_name: ${{ steps.ref_name.outputs.SOURCE_TAG }}
2021-02-05 00:10:54 +01:00
- name: Upload Debian Package
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2021-02-05 16:06:35 +01:00
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: build/bngblaster_${{ steps.ref_name.outputs.SOURCE_TAG }}_amd64.deb
asset_name: bngblaster-${{ steps.ref_name.outputs.SOURCE_TAG }}-${{ matrix.os }}_amd64.deb
asset_content_type: application/gzip