Build liberty-pre Mono/.net app #22
This file contains hidden or 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: Build liberty-pre Mono/.net app | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'zapret version' | |
| required: true | |
| default: '71' | |
| jobs: | |
| build_with_mono: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout repository with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 1 | |
| - name: Add old mono repository | |
| run: | | |
| sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
| echo "deb [arch=amd64 signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu nightly-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-nightly.list | |
| echo "deb [arch=amd64 signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu preview-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-preview.list | |
| - name: Install Mono | |
| run: sudo apt update && sudo apt install -y mono-complete nuget | |
| - name: Build the solution | |
| run: | | |
| nuget restore | |
| xbuild /p:Configuration=Release liberty-pre.sln | |
| - name: Get current date | |
| run: echo "BUILD_DATE=$(date +'%Y.%-m.%-d')" >> $GITHUB_ENV | |
| - name: Copy build folder for linux release | |
| run: | | |
| cp -r "bin/Release/" "bin/Release_linux/" | |
| mkdir -p "bin/Release_linux/bin" | |
| - name: Download and extract WinDivert and zapret | |
| run: | | |
| wget -O zapret.zip "https://github.com/bol-van/zapret/releases/download/v${{ github.event.inputs.version }}/zapret-v${{ github.event.inputs.version }}.zip" | |
| wget -O zapret.tar.gz "https://github.com/bol-van/zapret/releases/download/v${{ github.event.inputs.version }}/zapret-v${{ github.event.inputs.version }}.tar.gz" | |
| wget -O WinDivert.zip https://github.com/basil00/WinDivert/releases/download/v2.2.2/WinDivert-2.2.2-A.zip | |
| unzip -j WinDivert.zip "*/x64/WinDivert.dll" "*/x64/WinDivert64.sys" -d bin/Release/bin/ | |
| unzip -j zapret.zip "*/binaries/win64/winws.exe" "*/binaries/win64/cygwin1.dll" -d bin/Release/bin/ | |
| tar -xvzf zapret.tar.gz -C "bin/Release_linux/bin" --wildcards --strip-components=3 '*/binaries/x86_64/*' | |
| unzip -j zapret.zip "*/files/fake/tls_clienthello_www_google_com.bin" "*/files/fake/quic_initial_www_google_com.bin" "*/files/fake/tls_clienthello_vk_com.bin" "*/files/fake/quic_initial_vk_com.bin" -d "bin/Release/" | |
| unzip -j zapret.zip "*/files/fake/tls_clienthello_www_google_com.bin" "*/files/fake/quic_initial_www_google_com.bin" "*/files/fake/tls_clienthello_vk_com.bin" "*/files/fake/quic_initial_vk_com.bin" -d "bin/Release_linux/" | |
| - name: Rename and clean | |
| run: | | |
| mv "bin/Release/" "bin/liberty-pre-${{ env.BUILD_DATE }}" | |
| mv "bin/Release_linux/" "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| rm zapret.zip zapret.tar.gz WinDivert.zip | |
| - name: Copy lists and configs | |
| run: | | |
| cp data/*.txt "bin/liberty-pre-${{ env.BUILD_DATE }}" | |
| cp data/*.txt "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| cp data/*.cfg "bin/liberty-pre-${{ env.BUILD_DATE }}" | |
| cp data/*.cfg "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| cp LICENSE "bin/liberty-pre-${{ env.BUILD_DATE }}" | |
| cp LICENSE "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| cp README*.md "bin/liberty-pre-${{ env.BUILD_DATE }}" | |
| cp README*.md "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| cp components/*.sh "bin/liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| - name: Сompress Release | |
| run: | | |
| cd bin | |
| 7z a "../liberty-pre-${{ env.BUILD_DATE }}.zip" "liberty-pre-${{ env.BUILD_DATE }}" | |
| tar -czvf "../liberty-pre-linux-${{ env.BUILD_DATE }}.tar.gz" "liberty-pre-linux-${{ env.BUILD_DATE }}" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: liberty-pre-${{ env.BUILD_DATE }} | |
| path: | | |
| liberty-pre-*.zip | |
| liberty-pre-linux-*.tar.gz | |
| if-no-files-found: error | |
| - name: Create GitHub Release and Upload Artifact | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| liberty-pre-${{ env.BUILD_DATE }}.zip | |
| liberty-pre-linux-${{ env.BUILD_DATE }}.tar.gz | |
| tag_name: v${{ env.BUILD_DATE }} | |
| name: "Release liberty-pre-${{ env.BUILD_DATE }}" | |
| body: "liberty-pre v${{ env.BUILD_DATE }} automatic release. Used zapret-v${{ github.event.inputs.version }}, WinDivert 2.2.2-A" | |
| draft: false | |
| prerelease: false |