-
Notifications
You must be signed in to change notification settings - Fork 86
102 lines (90 loc) · 2.58 KB
/
Copy pathbuild.yml
File metadata and controls
102 lines (90 loc) · 2.58 KB
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
# SPDX-License-Identifier: GPL-3.0-only
name: Build Hybrid Mount
on:
push:
branches: ["dev"]
paths:
- "src/**"
- "Cargo.*"
- ".cargo/**"
- "module/**"
- "webui/**"
- "xtask/**"
- "tools/notify/**"
- ".github/workflows/build.yml"
pull_request:
branches: ["dev"]
paths:
- "src/**"
- "Cargo.*"
- ".cargo/**"
- "module/**"
- "webui/**"
- "xtask/**"
- "tools/notify/**"
- ".github/workflows/build.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: read
jobs:
build:
name: Build package
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: ghcr.io/hybrid-mount/meta-hybrid_mount-ci:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell: bash
steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
fetch-depth: 0
filter: "tree:0"
- name: Trust checkout directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
cache-on-failure: true
- name: Build package
run: |
set -euo pipefail
rm -rf output
cargo xtask build --ci
ZIP_PATH="$(find output -maxdepth 1 -type f -name '*.zip' | sort | head -n 1)"
test -n "$ZIP_PATH"
ZIP_FILENAME="$(basename "$ZIP_PATH")"
ARTIFACT_NAME="${ZIP_FILENAME%.*}"
echo "ARTIFACT_ZIP=$ZIP_PATH" >> "$GITHUB_ENV"
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> "$GITHUB_ENV"
- name: Upload package artifact
uses: actions/upload-artifact@v7
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_ZIP }}
compression-level: 0
if-no-files-found: error
- name: Notify Telegram
if: github.event_name != 'pull_request'
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
set -euo pipefail
rm -rf notify-output
mkdir notify-output
cp "$ARTIFACT_ZIP" notify-output/
cargo xtask notify \
--output notify-output \
--label "日常耕作 🌱 (Daily Tilling) - ${{ github.ref_name }}" \
--topic-id 37