add checksums [openvpnadapter] #18
This file contains 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 OpenVPNAdapter for Apple | |
on: [push] | |
jobs: | |
build-macos: | |
name: 'OpenVPNAdapter for macOS NE' | |
runs-on: macos-latest | |
if: | | |
contains(github.event.head_commit.message, '[all]') || | |
contains(github.event.head_commit.message, '[macos]') || | |
contains(github.event.head_commit.message, '[openvpnadapter]') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: 'Get OpenVPNAdapter' | |
uses: actions/checkout@v3 | |
with: | |
repository: amnezia-vpn/OpenVPNAdapter | |
ref: feature/macox-network-extension | |
path: OpenVPNAdapter | |
- name: Configure amnezia.xcconfig | |
run: | | |
export WORKINGDIR=`pwd` | |
echo "Working directory: $WORKINGDIR" | |
echo "Configuring amnezia.xcconfig..." | |
cat $WORKINGDIR/OpenVPNAdapter/Configuration/Project-MacNE.xcconfig > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig | |
cat << EOF >> $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig | |
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build | |
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos | |
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos | |
EOF | |
- name: Get macOS SDK | |
id: sdk_version | |
run: | | |
MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/') | |
echo "Using macOS SDK version: $MACOSX_SDK" | |
echo "::set-output name=sdk::$MACOSX_SDK" | |
- name: Build OpenVPNAdapter | |
run: | | |
cd OpenVPNAdapter | |
export XCODEBUILD="/usr/bin/xcodebuild" | |
$XCODEBUILD -scheme OpenVPNAdapter \ | |
-configuration Release \ | |
-xcconfig Configuration/amnezia.xcconfig \ | |
-sdk macosx${{ steps.sdk_version.outputs.sdk }} \ | |
-destination 'generic/platform=macOS' \ | |
-project OpenVPNAdapter.xcodeproj | |
- name: Remove CodeSignature | |
run: | | |
export WORKINGDIR=`pwd` | |
echo "Removing CodeSignature if exists..." | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework/Versions/A/_CodeSignature | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework/Versions/Current/_CodeSignature | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/LZ4.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNClient.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/mbedTLS.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework.dSYM | |
- name: Generate Checksums for macOS | |
run: | | |
export WORKINGDIR=`pwd` | |
find $WORKINGDIR/OpenVPNAdapter/build/Release-macos/ \ | |
-type f \( -name '*.framework' -o -name '*.dylib' \) \ | |
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \; | |
- name: Archive Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenVPNAdapter-macos | |
path: OpenVPNAdapter/build | |
build-ios: | |
name: 'OpenVPNAdapter for iOS' | |
runs-on: macos-latest | |
if: | | |
contains(github.event.head_commit.message, '[all]') || | |
contains(github.event.head_commit.message, '[ios]') || | |
contains(github.event.head_commit.message, '[openvpnadapter]') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: 'Get OpenVPNAdapter' | |
uses: actions/checkout@v3 | |
with: | |
repository: amnezia-vpn/OpenVPNAdapter | |
ref: master | |
path: OpenVPNAdapter | |
- name: Configure amnezia.xcconfig | |
run: | | |
export WORKINGDIR=`pwd` | |
echo "Configuring amnezia.xcconfig..." | |
cat $WORKINGDIR/OpenVPNAdapter/Configuration/Project.xcconfig > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig | |
cat << EOF >> $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig | |
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build | |
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos | |
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos | |
EOF | |
- name: Build OpenVPNAdapter for iOS | |
run: | | |
export SDK_PATH=`xcrun --sdk iphoneos --show-sdk-path` | |
export CLANG=`xcrun --sdk iphoneos --find clang` | |
export XCODEBUILD="/usr/bin/xcodebuild" | |
cd OpenVPNAdapter | |
$XCODEBUILD -scheme OpenVPNAdapter \ | |
-configuration Release \ | |
-xcconfig Configuration/amnezia.xcconfig \ | |
-sdk iphoneos \ | |
-destination 'generic/platform=iOS' \ | |
-project OpenVPNAdapter.xcodeproj | |
- name: Remove CodeSignature | |
run: | | |
export WORKINGDIR=`pwd` | |
echo "Removing CodeSignature if exists..." | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework/Versions/A/_CodeSignature | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework/Versions/Current/_CodeSignature | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/LZ4.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNClient.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/mbedTLS.framework | |
rm -rf $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework.dSYM | |
- name: Generate Checksums for iOS | |
run: | | |
export WORKINGDIR=`pwd` | |
find $WORKINGDIR/OpenVPNAdapter/build/Release-ios/ \ | |
-type f \( -name '*.framework' -o -name '*.dylib' \) \ | |
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \; | |
- name: Archive Build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenVPNAdapter-ios | |
path: OpenVPNAdapter/build | |
github-release: | |
name: GitHub Release | |
needs: [build-macos, build-ios] | |
runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/') | |
if: | | |
contains(github.event.head_commit.message, '[all]') || | |
contains(github.event.head_commit.message, '[macos]') || | |
contains(github.event.head_commit.message, '[openvpnadapter]') | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | Download macOS Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: OpenVPNAdapter-macos | |
path: openvpnadapter-mac/ | |
- name: Setup | Download iOS Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: OpenVPNAdapter-ios | |
path: openvpnadapter-ios/ | |
- name: Create Combined Folder | |
run: | | |
mkdir -p openvpnadapter | |
cp -r openvpnadapter-mac/ openvpnadapter/ | |
cp -r openvpnadapter-ios/ openvpnadapter/ | |
- name: Zip Combined Artifacts | |
run: | | |
zip -r openvpnadapter.zip openvpnadapter/ | |
shell: bash | |
- name: List Generated Files | |
run: ls -l | |
- name: Upload Binaries to GitHub Release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
file: openvpnadapter.zip | |
file_glob: false |