diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 0369490..a8a89dc 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -1,19 +1,75 @@ -name: build debian +name: Build and Release Debian Package on: push: - branches: [ "morteza/debian" ] - # paths: - # - 'core/**' + branches: + - morteza/debian + pull_request: + branches: + - morteza/debian jobs: build: + runs-on: ubuntu-24.04 + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Set up dependencies + run: | + sudo apt-get update + sudo apt-get install -y dpkg-dev build-essential lintian fakeroot devscripts cmake libssl-dev libboost-all-dev libyaml-cpp-dev + + - name: Build the package + run: | + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE=Debug .. + make -j$(nproc) + cd .. + mkdir -p nipovpn/usr/bin/ + cp build/core/nipovpn nipovpn/usr/bin/nipovpn + dpkg-deb --build nipovpn/ build/nipovpn.deb + + - name: Upload the Debian nipovpn as an artifact + uses: actions/upload-artifact@v3 + with: + name: nipovpn + path: build/nipovpn.deb + + - name: Show nipovpn information + run: | + dpkg -I build/nipovpn.deb + + release: + needs: build # This ensures that the release job runs after the build job runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - - name: build-deb-action - uses: jiro4989/build-deb-action@v3.1.0 + - name: Download build artifact + uses: actions/download-artifact@v3 + with: + name: nipovpn + path: ./ # Download the artifact to the current directory + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # GitHub token to authenticate the release + with: + tag_name: 'v1.0.${{ github.run_number }}' # Example versioning + release_name: Release ${{ github.run_number }} + draft: false + prerelease: false + + - name: Upload Debian Package to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # GitHub token to authenticate the release with: - package_root: ./nipovpn - + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./nipovpn.deb + asset_name: nipovpn.deb + asset_content_type: application/octet-stream diff --git a/README.md b/README.md index f9d01da..f2a8a82 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Create the log directory and log file Run it ```bash -sudo build/core/nipovpn_core server nipovpn/etc/nipovpn/config.yaml +sudo build/core/nipovpn server nipovpn/etc/nipovpn/config.yaml 2024-08-02_15:30:07 [INFO] Config initialized in server mode 2024-08-02_15:30:07 [INFO] Config : diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 99245ee..d8049f7 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,4 +1,4 @@ -set(CORE_TARGET nipovpn_core) +set(CORE_TARGET nipovpn) set(CMAKE_CXX_STANDARD 20) set(CORE_TARGET_HEADERS diff --git a/nipovpn/DEBIAN/control b/nipovpn/DEBIAN/control index 483067f..08df23e 100644 --- a/nipovpn/DEBIAN/control +++ b/nipovpn/DEBIAN/control @@ -1,7 +1,7 @@ -Package: nipovpn -Version: 0.1 -Maintainer: Morteza Bashsiz -Architecture: amd64 -Description: Powerfull and Secure http/s Proxy -Depends: libyaml-cpp0.8 -Homepage: https://github.com/MortezaBashsiz/nipovpn +Package : nipovpn +Version : 0.1 +Maintainer : Morteza Bashsiz +Architecture : amd64 +Description : Powerfull and Secure http/s Proxy +Depends : libyaml-cpp0.8 +Homepage : https://github.com/MortezaBashsiz/nipovpn