forked from aria2/aria2
-
Notifications
You must be signed in to change notification settings - Fork 3
116 lines (114 loc) · 4.31 KB
/
build.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
name: Build Binary
on:
push:
branches:
- build
watch:
types: [started]
jobs:
build:
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, macos-14-large]
# arch: [amd64, arm64]
arch: [amd64, arm64, 386, arm]
steps:
- name: Check Out Branch
uses: actions/checkout@master
with:
ref: build
- name: Linux Build
if: runner.os == 'Linux'
run: |
sudo apt install -y screen
mkdir ./artifact
arch=${{ matrix.arch }}
screen -dmS "pack_$arch" bash -c "nc -l 9999 > aria2c && chmod a+x aria2c && tar cvf $(pwd)/artifact/aria2c-linux-$arch.tar aria2c";
HOST=$(ip -4 address|grep docker|grep -oE '([0-9]+\.){3}[0-9]+'|grep -v 255)
docker run --rm --privileged tonistiigi/binfmt:latest --install all
docker buildx create --use --name=multibulider --driver docker-container --driver-opt image=moby/buildkit:master
docker buildx use multibulider
docker buildx build --build-arg HOST=${HOST} --platform linux/${arch} -t aria2 .
- name: macOS Build
if: ${{ (matrix.os == 'macos-14-large' && matrix.arch == 'amd64') || (matrix.os == 'macos-14' && matrix.arch == 'arm64') }}
run: |
brew install cppunit autoconf automake pkg-config libtool
git checkout build
(cd /Users/runner/work/aria2;mkdir build;cd build; ln -s ../aria2/makerelease-osx-static.mk ./Makefile; make ARCH=${{ matrix.arch == 'amd64' && 'x86_64' || matrix.arch }} V=s)
strip /Users/runner/work/aria2s/build/aria2-def/bin/aria2c
mkdir ./artifact/
mv /Users/runner/work/aria2s/build/aria2-def/bin/aria2c ./aria2c
tar cf ./artifact/aria2c-macos-${{ matrix.arch }}.tar aria2c
- name: upload macOS aria2c
if: ${{ (matrix.os == 'macos-14-large' && matrix.arch == 'amd64') || (matrix.os == 'macos-14' && matrix.arch == 'arm64') }}
uses: actions/upload-artifact@master
with:
name: aria2c-macos-${{ matrix.arch }}
path: ./artifact/
- name: upload Linux aria2c
if: runner.os == 'Linux'
uses: actions/upload-artifact@master
with:
name: aria2c-linux-${{ matrix.arch }}
path: ./artifact/
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set Build Date
run: echo "ReleaseVersion=`date +%Y%m%d`" >> $GITHUB_ENV
- name: Retrieve aria2c-macos-amd64
uses: actions/download-artifact@master
with:
name: aria2c-macos-amd64
path: ./artifact
- name: Retrieve aria2c-macos-arm64
uses: actions/download-artifact@master
with:
name: aria2c-macos-arm64
path: ./artifact
- name: Retrieve aria2c-linux-amd64
uses: actions/download-artifact@master
with:
name: aria2c-linux-amd64
path: ./artifact
- name: Retrieve aria2c-linux-arm64
uses: actions/download-artifact@master
with:
name: aria2c-linux-arm64
path: ./artifact
- name: Retrieve aria2c-linux-ppc64le
uses: actions/download-artifact@master
with:
name: aria2c-linux-ppc64le
path: ./artifact
- name: Retrieve aria2c-linux-s390x
uses: actions/download-artifact@master
with:
name: aria2c-linux-s390x
path: ./artifact
- name: Retrieve aria2c-linux-386
uses: actions/download-artifact@master
with:
name: aria2c-linux-386
path: ./artifact
- name: Retrieve aria2c-linux-arm
uses: actions/download-artifact@master
with:
name: aria2c-linux-arm
path: ./artifact
# - name: SSH 连接到 Actions
# uses: P3TERX/ssh2actions@main
# env:
# TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
automatic_release_tag: ${{ env.ReleaseVersion }}
title: ${{ env.ReleaseVersion }}
files: ./artifact/*