-
Notifications
You must be signed in to change notification settings - Fork 97
136 lines (114 loc) · 4.22 KB
/
cd-fedora.yml
File metadata and controls
136 lines (114 loc) · 4.22 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
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
name: CD for Mogan STEM on Fedora
on:
workflow_dispatch:
inputs:
manual_version:
description: 'Set version manually (e.g. 1.2.3)'
required: false
default: ''
push:
tags:
- '*'
jobs:
fedora-build:
runs-on: ubuntu-latest
container: fedora:latest
timeout-minutes: 60
env:
APPIMAGE_EXTRACT_AND_RUN: 1
XMAKE_ROOT: y
QT_QPA_PLATFORM: offscreen
steps:
# ==========================================
# 1. 环境准备
# ==========================================
- name: Install dependencies
run: |
dnf update -y
dnf install -y gcc gcc-c++ git unzip curl cmake ninja-build pkgconf-pkg-config \
google-noto-sans-cjk-fonts google-noto-serif-cjk-fonts libX11-devel \
freetype-devel fontconfig-devel libgit2-devel \
zlib-devel openssl-devel libjpeg-turbo-devel libpng-devel libcurl-devel \
mimalloc-devel dbus-devel glib2-devel harfbuzz-devel \
libxkbcommon-devel mesa-libGL-devel mesa-libEGL-devel \
xmake pandoc python3 p7zip p7zip-plugins \
rpm-build file patchelf ibus ghostscript
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: git add safe directory
run: git config --global --add safe.directory '*'
- name: set XMAKE_GLOBALDIR
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
- name: xmake repo --update
run: xmake repo --update
- name: cache packages from xrepo
uses: actions/cache@v4
with:
path: |
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ runner.os }}-fedora-xrepo-qt683-${{ hashFiles('**/packages.lua') }}
- name: cache xmake
uses: actions/cache@v4
with:
path: |
tmp/build/.build_cache
key: ${{ runner.os }}-fedora-build-qt683-${{ hashFiles('**/packages.lua') }}
# ==========================================
# 3. 编译流程
# ==========================================
- name: Config
run: xmake config --yes -vD -m release --policies=build.ccache -o tmp/build
- name: Build
run: xmake build -vD stem
# ==========================================
# 4. 确定版本号
# ==========================================
- name: Determine Version
id: get_version
shell: bash
run: |
REF_NAME="${{ github.ref }}"
MANUAL_VER="${{ inputs.manual_version }}"
if [ -n "$MANUAL_VER" ]; then
RAW_VERSION="$MANUAL_VER"
elif [[ "$REF_NAME" == refs/tags/* ]]; then
RAW_VERSION=${REF_NAME#refs/tags/}
RAW_VERSION=${RAW_VERSION//\//}
else
RAW_VERSION=$(date +%Y.%m.%d)
fi
if [[ "$RAW_VERSION" == v* ]]; then
CLEAN_VERSION=${RAW_VERSION#v}
else
CLEAN_VERSION="$RAW_VERSION"
fi
echo "File Name will use: $RAW_VERSION"
echo "Internal Package Version will use: $CLEAN_VERSION"
echo "VERSION_TAG=$RAW_VERSION" >> $GITHUB_ENV
echo "VERSION_NUM=$CLEAN_VERSION" >> $GITHUB_ENV
# ==========================================
# 5. 打包
# ==========================================
- name: Generate RPM Package
run: |
chmod +x packages/fedora/package.sh
export VERSION=${{ env.VERSION_NUM }}
packages/fedora/package.sh
mv rpmbuild/RPMS/x86_64/mogan-stem-*.rpm ./mogan-stem-${{ env.VERSION_TAG }}-fedora-amd64.rpm
# ==========================================
# 6. 上传与发布
# ==========================================
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
name: mogan-stem-fedora-${{ env.VERSION_TAG }}
path: mogan-stem-*-fedora-amd64.rpm
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: true
files: |
mogan-stem-*-fedora-amd64.rpm