Skip to content

Workflow file for this run

# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake Build GitHubDesktop2Chinese
on:
push:
tags:
- '*'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: utf8
# 使用utf8编码环境编译
run: chcp 65001
- name: Get tag
id: tag
uses: devops-actions/action-get-tag@v1.0.2
with:
default: v0.0.0 # Optional: Default version when tag not found
- name: Configure CMake x64
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: chcp 65001 && cmake -B ${{github.workspace}}/build -A x64 -DGitHubActions=1 -DFILE_VERSION="${{steps.tag.outputs.tag}}"
- name: Build x64
# Build your program with the given configuration
run: chcp 65001 && cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Configure CMake x86
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: chcp 65001 && cmake -B ${{github.workspace}}/build32 -A Win32 -DGitHubActions=1 -DFILE_VERSION="${{steps.tag.outputs.tag}}"
- name: Build x86
# Build your program with the given configuration
run: chcp 65001 && cmake --build ${{github.workspace}}/build32 --config ${{env.BUILD_TYPE}}
- name: rename
# Build your program with the given configuration
run: move ${{github.workspace}}/build32/${{env.BUILD_TYPE}}/GitHubDesktop2Chinese.exe ${{github.workspace}}/build32/${{env.BUILD_TYPE}}/GitHubDesktop2Chinese_x86.exe
- name: Upload Release GitHubDesktop2Chinese.exe
uses: actions/upload-artifact@v4
with:
name: GitHubDesktop2Chinese
path: |
${{github.workspace}}/build/${{env.BUILD_TYPE}}/GitHubDesktop2Chinese.exe
${{github.workspace}}/build32/${{env.BUILD_TYPE}}/GitHubDesktop2Chinese_x86.exe
publish_release:
name: Publish release
needs: build
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ${{github.workspace}}/build/
- name: Get tag
id: tag
uses: devops-actions/action-get-tag@v1.0.2
with:
default: v0.0.0 # Optional: Default version when tag not found
- name: env_isPrerelease
run: |
chcp 65001
$result = ("${{steps.tag.outputs.tag}}" -like "*beta*" -as [string]).ToLower()
echo "isPrerelease=$result" >> $GITHUB_ENV
- name: tree
run: chcp 65001 && cmd /c tree ./build /F && echo ${{needs.publish_release.outputs.isPrerelease}}
- name: Create release
#if: github.event.inputs.status != 'stable'
uses: ncipollo/release-action@v1
with:
#prerelease: false # 是否是预览版
prerelease: ${{needs.publish_release.outputs.isPrerelease}}
tag: ${{steps.tag.outputs.tag}}
bodyFile: "ReleaseBody.md"
#name: 0
artifacts: |
./build/GitHubDesktop2Chinese/build/Release/GitHubDesktop2Chinese.exe
./build/GitHubDesktop2Chinese/build32/Release/GitHubDesktop2Chinese_x86.exe
./json/localization.json
env:
GITHUB_REPOSITORY: CNGEGE/GitHubDesktop2Chinese