feat: add launch on startup and exit functionality with first run det… #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |