-
Notifications
You must be signed in to change notification settings - Fork 477
173 lines (169 loc) · 5.86 KB
/
build.yaml
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: 'release docker'
on:
workflow_run:
workflows: [ "release base" ]
types:
- completed
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- 'build*'
- 'release*'
- 'config/**'
- 'doc/**'
- 'README.md'
- 'pom.xml'
- 'Dockerfile-v7'
- 'Dockerfile'
- 'Dockerfile-base'
- 'Dockerfile-base-new'
- 'Dockerfile-native-base'
- 'Dockerfile-jre'
- 'scripts/install.sh'
- '.github/workflows/build-base.yaml'
- '.github/workflows/build-base-new.yaml'
- '.github/workflows/build-native-dev.yaml'
- '.github/workflows/build-native-base.yaml'
- '.github/workflows/build-dev.yaml'
- '.github/workflows/build-java.yaml'
- '.github/workflows/build-v7.yaml'
- '.github/ISSUE_TEMPLATE/**'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: ./web-ui
- name: Install npm
working-directory: ./web-ui
run: npm ci
- name: Build web UI
working-directory: ./web-ui
run: npm run build
- name: setup graalvm
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm' # See 'Options' for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Extract Spring Boot layers
working-directory: ./target
run: java -Djarmode=layertools -jar alist-tvbox-1.0.jar extract
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set APP version
run: |
[ -d data ] || mkdir data
export TZ=Asia/Shanghai
echo $((($(date +%Y) - 2023) * 366 + $(date +%j | sed 's/^0*//'))).$(date +%H%M) > data/version
echo "${{ github.event.head_commit.message }}" >> data/version
cp data/version data/app_version
cat data/version
- name: Build docker and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-xiaoya
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaoya-tvbox:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build host mode docker and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-host
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaoya-tvbox:hostmode
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build standalone docker and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/alist-tvbox:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build native with Maven
run: |
export TOOLCHAIN_DIR=/opt/x86_64-linux-musl-native/
export CC=$TOOLCHAIN_DIR/bin/gcc
export PATH="$TOOLCHAIN_DIR/bin:$PATH"
sudo apt update
sudo apt install build-essential libz-dev zlib1g-dev zlib1g -y
wget https://more.musl.cc/10.2.1/x86_64-linux-musl/x86_64-linux-musl-native.tgz
tar xf x86_64-linux-musl-native.tgz -C /opt
wget https://zlib.net/zlib-1.3.1.tar.gz
tar xf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure --prefix=$TOOLCHAIN_DIR --static
make
sudo make install
cd ..
mvn -B -Pnative package --file pom.xml
- name: Build native docker and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-native
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaoya-tvbox:native
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build host native docker and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile-native-host
platforms: linux/amd64
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaoya-tvbox:native-host
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Send version file
env:
ssh_host: ${{ secrets.SSH_HOST }}
if: ${{ env.ssh_host != '' }}
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
port: 22
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: "data/app_version,scripts/update_new.sh,scripts/update_xiaoya.sh,scripts/update_hostmode.sh,scripts/update_native.sh,scripts/update_native_host.sh"
strip_components: 1
target: /var/www/alist/
- name: send telegram message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.CHANNEL_ID }}
token: ${{ secrets.BOT_TOKEN }}
message: |
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}