|
| 1 | +name: Build chums-proxy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-ios: |
| 10 | + name: Build for aarch64-apple-ios |
| 11 | + runs-on: [self-hosted, macOS, ARM64] |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v3 |
| 15 | + |
| 16 | + - name: Build for aarch64-apple-ios |
| 17 | + run: cargo build --target aarch64-apple-ios --lib --release |
| 18 | + |
| 19 | + - name: Update dylib |
| 20 | + run: | |
| 21 | + cd target/aarch64-apple-ios/release |
| 22 | + lipo "libchums_proxy.dylib" -output "libchums_proxy" -create |
| 23 | +
|
| 24 | + - name: Clone flutter-chums-proxy repository |
| 25 | + run: | |
| 26 | + git clone https://github.com/Chums-Team/flutter-chums-proxy.git flutter-chums-proxy |
| 27 | +
|
| 28 | + - name: ZIP artifacts |
| 29 | + run: | |
| 30 | + mkdir -p dist |
| 31 | + cp target/aarch64-apple-ios/release/libchums_proxy.* dist/ |
| 32 | + cp -r flutter-chums-proxy/chums_proxy_ios/ios/Frameworks/libchums_proxy.xcframework dist/ |
| 33 | + cp target/aarch64-apple-ios/release/libchums_proxy dist/libchums_proxy.xcframework/ios-arm64/libchums_proxy.framework |
| 34 | + cd dist/ |
| 35 | + zip -r chums-proxy-ios.zip . |
| 36 | +
|
| 37 | + - name: Upload artifact |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: chums-proxy-ios |
| 41 | + path: dist/chums-proxy-ios.zip |
| 42 | + |
| 43 | + build-windows: |
| 44 | + name: Build for x86_64-pc-windows-msvc |
| 45 | + runs-on: windows-latest |
| 46 | + steps: |
| 47 | + - name: Checkout repository |
| 48 | + uses: actions/checkout@v3 |
| 49 | + |
| 50 | + - name: Set up Rust + target |
| 51 | + run: rustup target add x86_64-pc-windows-msvc |
| 52 | + |
| 53 | + - name: Build for x86_64-pc-windows-msvc |
| 54 | + run: cargo build --target x86_64-pc-windows-msvc --release |
| 55 | + |
| 56 | + - name: ZIP artifacts |
| 57 | + run: | |
| 58 | + mkdir dist |
| 59 | + Copy-Item "target\x86_64-pc-windows-msvc\release\*.exe" -Destination dist |
| 60 | + Compress-Archive -Path dist\* -DestinationPath chums-proxy-windows.zip |
| 61 | +
|
| 62 | + - name: Upload artifact |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + name: chums-proxy-windows |
| 66 | + path: chums-proxy-windows.zip |
| 67 | + |
| 68 | + release: |
| 69 | + name: Create GitHub Release |
| 70 | + runs-on: [self-hosted, macOS, ARM64] |
| 71 | + needs: |
| 72 | + - build-ios |
| 73 | + - build-windows |
| 74 | + steps: |
| 75 | + - name: Download iOS artifact |
| 76 | + uses: actions/download-artifact@v4 |
| 77 | + with: |
| 78 | + name: chums-proxy-ios |
| 79 | + path: ios |
| 80 | + |
| 81 | + - name: Download Windows Artifact |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + name: chums-proxy-windows |
| 85 | + path: windows |
| 86 | + |
| 87 | + - name: Generate timestamp |
| 88 | + id: meta |
| 89 | + run: | |
| 90 | + timestamp="$(date +'%Y-%m-%dT%H-%M-%S')" |
| 91 | + echo "tag_name=v$timestamp" >> "$GITHUB_OUTPUT" |
| 92 | + echo "release_name=Release ${timestamp//T/ }" >> "$GITHUB_OUTPUT" |
| 93 | +
|
| 94 | + - name: Create GitHub Release |
| 95 | + uses: softprops/action-gh-release@v2 |
| 96 | + with: |
| 97 | + name: ${{ steps.meta.outputs.release_name }} |
| 98 | + tag_name: ${{ steps.meta.outputs.tag_name }} |
| 99 | + files: | |
| 100 | + ios/chums-proxy-ios.zip |
| 101 | + windows/chums-proxy-windows.zip |
| 102 | + generate_release_notes: true |
| 103 | + env: |
| 104 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments