-
Notifications
You must be signed in to change notification settings - Fork 75
153 lines (136 loc) · 4.08 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Release
on:
push:
branches:
- main
tags:
- 'v*'
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/**'
- 'Package.swift'
- '!.github/workflows/release.yml'
jobs:
build:
permissions: write-all
strategy:
fail-fast: false
matrix:
job:
- { os: 'ubuntu-latest', target: 'android' }
- { os: 'ubuntu-latest', target: 'linux-amd64', aarch: 'x64' }
- { os: 'ubuntu-latest', target: 'windows-amd64', aarch: 'x64' }
- { os: 'macos-11', target: 'macos-universal' }
- { os: "macos-11", target: "ios" }
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: false
- name: Setup Java
if: startsWith(matrix.job.target,'android')
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup NDK
if: startsWith(matrix.job.target,'android')
uses: nttld/setup-ndk@v1.4.0
id: setup-ndk
with:
ndk-version: r26b
add-to-path: true
local-cache: false
link-to-sdk: true
- name: Setup MinGW
if: startsWith(matrix.job.target,'windows')
uses: egor-tensin/setup-mingw@v2
with:
platform: ${{ matrix.job.aarch }}
- name: Setup macos
if: startsWith(matrix.job.target,'macos') || startsWith(matrix.job.target,'ios')
run: |
brew install create-dmg tree coreutils
- name: Build
run: |
make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
- name: zip
run: |
tree
rm -f ./bin/*.h
rm ./bin/hiddify-libcore*sources* ||echo "no source"
rm ./bin/hiddify-libcore-macos-a*.dylib || echo "no macos arm and amd"
if [[ "${{ matrix.job.target }}" == "ios" ]];then
cd bin
zip -r hiddify-libcore-ios.xcframework.zip hiddify-libcore-ios.xcframework
rm -rf hiddify-libcore-ios.xcframework
else
gzip -r -S ".gz" ./bin/hiddify-libcore*
fi
- name: Calculate SHA256 Checksum
if: startsWith(matrix.job.target,'ios')
run: |
sha256sum hiddify-libcore-ios.xcframework.zip | awk '{print $1}'> hiddify-libcore-ios.xcframework.zip.sha256
working-directory: bin
- uses: actions/upload-artifact@v3
if: ${{ success() }}
with:
name: artifact
path: bin/
upload-prerelease:
permissions: write-all
if: ${{ github.ref_type=='branch' }}
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: bin/
- name: Display Files Structure
run: ls -R
working-directory: bin
- name: Delete Current Release Assets
uses: 8Mi-Tech/delete-release-assets-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: 'draft'
deleteOnlyFromDrafts: false
- name: Create or Update Draft Release
uses: softprops/action-gh-release@v1
if: ${{ success() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./bin/*
name: 'draft'
tag_name: 'draft'
prerelease: true
upload-release:
permissions: write-all
if: ${{ github.ref_type=='tag' }}
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: bin/
- name: Display Files Structure
run: ls -R
working-directory: bin
- name: Upload Release
uses: softprops/action-gh-release@v1
if: ${{ success() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
files: bin/*