-
Notifications
You must be signed in to change notification settings - Fork 17
82 lines (71 loc) · 2.69 KB
/
Release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
type: string
jobs:
release:
runs-on: macOS-12
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: 'EbrahimTahernejad/sing-box'
path: 'box'
- name: Setup Go
uses: actions/[email protected]
with:
go-version: '1.20'
- name: Setup Gomobile
run: |
cd box
make lib_install
gomobile init
- name: Build xcframework
run: |
cd box
go run ./cmd/internal/build_libbox -target=ios
zip -ry ./Libbox.xcframework.zip ./Libbox.xcframework
- name: Detect checksum
run: |
export TEMP=`shasum -a 256 box/Libbox.xcframework.zip`
export CHECKSUM=${TEMP:0:64}
echo "FILE_CHECKSUM=${CHECKSUM}" >> $GITHUB_ENV
unset CHECKSUM
unset TEMP
- name: Update package file
run: |
echo "// swift-tools-version: 5.7" > Package.swift
echo "" >> Package.swift
echo "import PackageDescription" >> Package.swift
echo "" >> Package.swift
echo "let package = Package(" >> Package.swift
echo " name: \"Libbox\"," >> Package.swift
echo " platforms: [.iOS(.v12)]," >> Package.swift
echo " products: [" >> Package.swift
echo " .library(name: \"Libbox\", targets: [\"Libbox\"])" >> Package.swift
echo " ]," >> Package.swift
echo " targets: [" >> Package.swift
echo " .binaryTarget(" >> Package.swift
echo " name: \"Libbox\"," >> Package.swift
echo " url: \"https://github.com/EbrahimTahernejad/sing-box-lib/releases/download/${{ github.event.inputs.version }}/Libbox.xcframework.zip\"," >> Package.swift
echo " checksum: \"${{ env.FILE_CHECKSUM }}\"" >> Package.swift
echo " )" >> Package.swift
echo " ]" >> Package.swift
echo ")" >> Package.swift
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Libbox Release ${{ github.event.inputs.version }}
commit_user_name: Ebrahim
commit_user_email: [email protected]
tagging_message: ${{ github.event.inputs.version }}
file_pattern: 'Package.swift'
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
draft: false
tag_name: ${{ github.event.inputs.version }}
files: box/Libbox.xcframework.zip