Skip to content

Update readme.md

Update readme.md #227

Workflow file for this run

name: C/C++ CI
on:
push:
branches: [ main, "*" ]
tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Initialize variables
env:
IS_NEED_TO_PACKAGE: ${{ startsWith( github.ref, 'refs/tags/v' ) }}
GITHUB_REF: ${{ github.ref }}
run: |
cat <<EOF >> $GITHUB_ENV
IS_NEED_TO_PACKAGE=$IS_NEED_TO_PACKAGE
PACKAGE_VERSION=$(echo $GITHUB_REF | tr -d 'refs/tags/' )
EOF
- uses: actions/checkout@v3
- name: setup environment
run: |
sudo apt update && sudo apt-get install libxml2-dev liblzma-dev libicu-dev libpcap-dev libconfuse-dev libsctp-dev gcc make wget
#wget https://github.com/Montimage/mmt-dpi/releases/download/v1.7.4/mmt-dpi_1.7.4_42d37eb_Linux_x86_64.deb
#sudo dpkg -i lib/mmt-dpi*.deb && sudo ldconfig
- name: install mmt-dpi
run: |
git clone https://github.com/Montimage/mmt-dpi.git
cd mmt-dpi/sdk
make -j
sudo make install && sudo ldconfig
- name: make
run: make
- name: make static
run: make STATIC_LINK=1 VERBOSE=1
- name: compile sample rules
run: make sample-rules
#The following steps are executed only on new tag
- name: Upload artifact
if: ${{ fromJSON(env.IS_NEED_TO_PACKAGE) }}
env:
TAG_NAME: ${{ github.ref }}
run: |
make STATIC_LINK=1 dist
#get name of distribution tar file
ARTIFACT_PATHNAME=$(ls 5greplay*.tar.gz | head -n 1)
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
echo ARTIFACT_NAME=${ARTIFACT_NAME} >> $GITHUB_ENV
echo ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME} >> $GITHUB_ENV
- name: Create Release
if: ${{ fromJSON(env.IS_NEED_TO_PACKAGE) }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PACKAGE_VERSION }}
release_name: Release ${{ env.PACKAGE_VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
if: ${{ fromJSON(env.IS_NEED_TO_PACKAGE) }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ env.ARTIFACT_PATHNAME }}
asset_name: ${{ env.ARTIFACT_NAME }}
asset_content_type: application/zip
- name: Log in to the Container registry
if: ${{ fromJSON(env.IS_NEED_TO_PACKAGE) }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images
if: ${{ fromJSON(env.IS_NEED_TO_PACKAGE) }}
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/montimage/5greplay:${{ env.PACKAGE_VERSION }}
ghcr.io/montimage/5greplay:latest