-
Notifications
You must be signed in to change notification settings - Fork 15
113 lines (110 loc) · 3.59 KB
/
build_and_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
name: "Build and Release"
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
release:
types:
- released
schedule:
- cron: "0 0 * * 6"
jobs:
create-prerelease:
name: Create Prerelease
if: github.event_name == 'push' || github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set current date as env variable
run: echo "NOW=$(date --utc)" >> $GITHUB_ENV
- name: Delete Continuous Release
run: gh release delete continuous --cleanup-tag || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Prerelease Tag
id: create_prerelease_tag
run: |
gh release create continuous -p -t 'Continuous build' --notes "Building time: ${NOW}
- - -
"
# Make sure draft is false
gh release edit continuous --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
static-build:
runs-on: ubuntu-latest
container: "ghcr.io/abcfy2/musl-cross-toolchain-ubuntu:${{ matrix.cross_host }}"
strategy:
fail-fast: false
matrix:
cross_host:
- arm-unknown-linux-musleabi
- aarch64-unknown-linux-musl
- mips-unknown-linux-musl
- mipsel-unknown-linux-musl
- mips64-unknown-linux-musl
- x86_64-unknown-linux-musl
- x86_64-w64-mingw32
- i686-w64-mingw32
use_libressl: [0, 1]
exclude:
- cross_host: x86_64-w64-mingw32
use_libressl: 1
- cross_host: i686-w64-mingw32
use_libressl: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache
with:
path: downloads/
key: build-cache-${{ matrix.cross_host }}-${{ github.sha }}
restore-keys: |
build-cache-${{ matrix.cross_host }}-
- name: compile
env:
CROSS_HOST: "${{ matrix.cross_host }}"
USE_LIBRESSL: "${{ matrix.use_libressl }}"
run: |
if [ "${GITHUB_EVENT_NAME}" = release ]; then
export ARIA2_VER="${GITHUB_REF#refs/*/}"
echo "ARIA2_VER=${ARIA2_VER}" >> $GITHUB_ENV
fi
"${GITHUB_WORKSPACE}/build.sh"
- name: zip archiving
env:
CROSS_HOST: "${{ matrix.cross_host }}"
USE_LIBRESSL: "${{ matrix.use_libressl }}"
run: |
apt install -y zip
if [ x"${USE_LIBRESSL}" = x"1" ]; then
ARCHIVE_NAME="aria2-${CROSS_HOST//-unknown/}_libressl_static.zip"
else
ARCHIVE_NAME="aria2-${CROSS_HOST//-unknown/}_static.zip"
fi
echo "ARCHIVE_NAME=${ARCHIVE_NAME}" >> $GITHUB_ENV
zip -j9v "/tmp/${ARCHIVE_NAME}" "${GITHUB_WORKSPACE}"/aria2c*
- name: Prerelease assets
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: softprops/action-gh-release@v2
with:
files: /tmp/${{ env.ARCHIVE_NAME }}
prerelease: true
draft: false
tag_name: continuous
name: Continuous build
body_path: "${{ github.workspace }}/build_info.md"
append_body: true
- name: Upload Github Assets
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: /tmp/${{ env.ARCHIVE_NAME }}
name: aria2 ${{ env.ARIA2_VER }} static release
body_path: "${{ github.workspace }}/build_info.md"
append_body: true