Skip to content

Commit

Permalink
Add auto release
Browse files Browse the repository at this point in the history
  • Loading branch information
UjuiUjuMandan committed Nov 23, 2023
1 parent 3c8638d commit 68784a5
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and upload artifacts
name: CI

on:
push:
Expand Down
140 changes: 140 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Releases

on:
push:
tags:
- "*"

jobs:
job:
permissions:
contents: write
env:
VCPKG_ROOT: '${{ github.workspace }}\vcpkg'
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup CMake and dependencies on macOS
if: ${{ runner.os == 'macOS' }}
run: |
brew install cmake libevent libpcap libsodium openssl
- name: Setup CMake, GCC, and dependencies on Ubuntu
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ cmake libevent-dev libpcap-dev libsodium-dev libssl-dev
- name: Install MSBuild
if: ${{ runner.os == 'Windows' }}
uses: microsoft/[email protected]

- name: Restore vcpkg and its artifacts
if: ${{ runner.os == 'Windows' }}
uses: actions/cache@v3
id: vcpkg-cache
with:
path: |
${{ env.VCPKG_ROOT }}
${{ env.VCPKG_ROOT }}\packages
!${{ env.VCPKG_ROOT }}\.git
!${{ env.VCPKG_ROOT }}\buildtrees
!${{ env.VCPKG_ROOT }}\downloads
Source/Tools
key: |
${{ hashFiles( 'vcpkg.bat' ) }}-${{ runner.os }}-cache-key-v1
- name: Install vcpkg and dependencies on Windows
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg.bat
- name: Build the solution
if: ${{ runner.os == 'Windows' }}
run: |
.\vcpkg\vcpkg integrate install
mkdir Source/Dependency
mkdir Source/Dependency/LibEvent
mkdir Source/Dependency/LibEvent/Include_Windows
mkdir Source/Dependency/LibSodium
mkdir Source/Dependency/LibSodium/Include_Windows
mkdir Source/Dependency/WinPcap
mkdir Source/Dependency/WinPcap/Include
cp -Recurse vcpkg/packages/libevent_x64-windows/include/* Source/Dependency/LibEvent/Include_Windows
cp -Recurse vcpkg/packages/libevent_x64-windows/lib/event_core.lib Source/Dependency/LibEvent/LibEvent_Core_x64.lib
cp -Recurse vcpkg/packages/libsodium_x64-windows/include/* Source/Dependency/LibSodium/Include_Windows
cp -Recurse vcpkg/packages/libsodium_x64-windows/lib/libsodium.lib Source/Dependency/LibSodium/LibSodium_x64.lib
cp -Recurse vcpkg/packages/libpcap_x64-windows/include/* Source/Dependency/WinPcap/Include
cp -Recurse vcpkg/packages/winpcap_x64-windows/lib/Packet.lib Source/Dependency/WinPcap/Packet_x64.lib
cp -Recurse vcpkg/packages/winpcap_x64-windows/lib/wpcap.lib Source/Dependency/WinPcap/WPCAP_X64.lib
msbuild Source/Pcap_DNSProxy.sln /p:Configuration=Release /p:Platform=x64 /p:AdditionalIncludeDirectories="$GITHUB_WORKSPACE\vcpkg\installed\x64-windows\include"
cp -Recurse -Force vcpkg/packages/libevent_x86-windows/include/* Source/Dependency/LibEvent/Include_Windows
cp -Recurse -Force vcpkg/packages/libevent_x86-windows/lib/event_core.lib Source/Dependency/LibEvent/LibEvent_Core_x86.lib
cp -Recurse -Force vcpkg/packages/libsodium_x86-windows/include/* Source/Dependency/LibSodium/Include_Windows
cp -Recurse -Force vcpkg/packages/libsodium_x86-windows/lib/libsodium.lib Source/Dependency/LibSodium/LibSodium_x86.lib
cp -Recurse -Force vcpkg/packages/libpcap_x86-windows/include/* Source/Dependency/WinPcap/Include
cp -Recurse -Force vcpkg/packages/winpcap_x86-windows/lib/Packet.lib Source/Dependency/WinPcap/Packet_x86.lib
cp -Recurse -Force vcpkg/packages/winpcap_x86-windows/lib/wpcap.lib Source/Dependency/WinPcap/WPCAP_X86.lib
msbuild Source/Pcap_DNSProxy.sln /p:Configuration=Release /p:Platform=x86 /p:AdditionalIncludeDirectories="$GITHUB_WORKSPACE\vcpkg\installed\x86-windows\include"
- name: Compile and configure Pcap_DNSProxy
run: |
cd Source/Auxiliary/Scripts
chmod +x CMake_Build.sh
./CMake_Build.sh
- name: Download Support for Windows
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
cd Source
mkdir Tools
mkdir Tools/Support
Invoke-WebRequest https://www.winpcap.org/install/bin/WinPcap_4_1_3.exe -OutFile Tools/WinPcap_4.1.3.exe
Invoke-WebRequest https://westmesatech.com/files/sst27.zip -OutFile Tools/sst27.zip
Expand-Archive Tools/sst27.zip -DestinationPath Tools/Support
Invoke-WebRequest https://www.fourmilab.ch/md5/md5.zip -OutFile Tools/md5.zip
Expand-Archive Tools/md5.zip -DestinationPath Tools/Support
Invoke-WebRequest https://github.com/mbuilov/sed-windows/raw/master/sed-4.9-x86.exe -OutFile Tools/Support/sed.exe
- name: Package release for Windows
if: ${{ runner.os == 'Windows' }}
run: |
cd Source
mkdir Release/x64
cp -Recurse x64/Release/* Release/x64
cp Auxiliary/ExampleConfig/Config.ini Release
cp Auxiliary/ExampleConfig/Hosts.ini Release
cp Auxiliary/ExampleConfig/IPFilter.ini Release
cp Auxiliary/ExampleConfig/Routing.txt Release
cp Auxiliary/ExampleConfig/WhiteList.txt Release
cp Auxiliary/ExampleConfig/ServiceControl.bat Release
mkdir Release/Tools
cp -Recurse Auxiliary/Tools/* Release/Tools
cp Tools/WinPcap_4.1.3.exe Release/Tools
mkdir Release/Tools/Support
cp Tools/Support/CCase.exe Release/Tools/Support
cp (Get-Command curl.exe).Path Release/Tools/Support
cp Tools/Support/md5.exe Release/Tools/Support
cp Tools/Support/sed.exe Release/Tools/Support
- name: Package release
uses: thedoctor0/[email protected]
with:
type: '7z'
filename: 'Pcap_DNSProxy-${{ github.ref_name }}-bin-${{ runner.os }}.7z'
directory: Source/Release

- name: Releases
uses: softprops/action-gh-release@v1
with:
files: |
Pcap_DNSProxy-${{ github.ref_name }}-bin-${{ runner.os }}.7z

0 comments on commit 68784a5

Please sign in to comment.