-
Notifications
You must be signed in to change notification settings - Fork 88
137 lines (117 loc) · 4.44 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Build
on:
push:
branches:
- main
paths-ignore:
- ".clang-format"
- ".gitignore"
- "README.md"
- "README_CN.md"
- "LICENSE"
- "setdll/**"
- "src/version.h"
- ".github/ISSUE_TEMPLATE/**"
workflow_dispatch:
inputs:
version:
description: 'Release version (SemVer)'
required: true
jobs:
build:
strategy:
matrix:
include:
- name: build_x86
arch: x86
- name: build_x64
arch: x64
- name: build_arm64
arch: arm64
name: ${{ matrix.name }}
runs-on: windows-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Update version.h
shell: bash
run: |
if [ "${{ github.event_name }}" == "push" ]; then
COMMIT_HASH=$(git rev-parse --short HEAD)
VERSION="alpha-${COMMIT_HASH}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
sed -i '/#define RELEASE_VER_STR/,/TOSTRING(RELEASE_VER_FIX)/c\#define RELEASE_VER_STR "'"$VERSION"'"' src/version.h
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
sed -i 's/#define RELEASE_VER_MAIN .*/#define RELEASE_VER_MAIN '"$MAJOR"'/' src/version.h
sed -i 's/#define RELEASE_VER_SUB .*/#define RELEASE_VER_SUB '"$MINOR"'/' src/version.h
sed -i 's/#define RELEASE_VER_FIX .*/#define RELEASE_VER_FIX '"$PATCH"'/' src/version.h
fi
- name: Setup VC-LTL
run: nuget install VC-LTL
- name: Setup Xmake
uses: xmake-io/github-action-setup-xmake@v1
- name: Configure Xmake
run: xmake f -a ${{ matrix.arch }}
- name: Build Chrome++
run: xmake
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: version-${{ matrix.arch }}-${{ env.VERSION }}
path: build/release/*
create_pr:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Git Configurations
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: build_artifacts
- name: Install 7zz
run: sudo apt install 7zip
- name: Update version.h
run: |
VERSION="${{ github.event.inputs.version }}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
sed -i 's/#define RELEASE_VER_MAIN .*/#define RELEASE_VER_MAIN '"$MAJOR"'/' src/version.h
sed -i 's/#define RELEASE_VER_SUB .*/#define RELEASE_VER_SUB '"$MINOR"'/' src/version.h
sed -i 's/#define RELEASE_VER_FIX .*/#define RELEASE_VER_FIX '"$PATCH"'/' src/version.h
git add src/version.h
git commit -m "Bump version"
- name: Update SetDll
run: |
mv build_artifacts/version-x86-${{ env.VERSION }}/version.dll chrome++32.dll
mv build_artifacts/version-x64-${{ env.VERSION }}/version.dll chrome++64.dll
cp chrome++32.dll setdll/
cp chrome++64.dll setdll/
cp src/chrome++.ini setdll/
rm setdll/setdll.7z || true
cd setdll
7zz a -mx=9 -ms=on -m0=lzma2 -mmt=on ../setdll.7z ./*
cd ..
mv setdll.7z setdll/
git add setdll/
git commit -m "Update setdll binaries"
git push origin release --force
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
git push origin release
gh pr create --base main --head release --title "build(release): bump version to ${{ github.event.inputs.version }}" --body "Bump version to ${{ github.event.inputs.version }}"
- name: Output Run ID
run: echo "RUN_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT