Skip to content

Commit

Permalink
[workflow] add release job
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwillow committed Dec 10, 2024
1 parent cf5072c commit 23f12d9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ on:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master" ]
# 当创建标签时也触发此工作流
create:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
build-and-test:
# 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
Expand All @@ -36,10 +38,27 @@ jobs:

- name: Build
# Build your program with the given configuration
run: cmake --build --preset=default --config ${{env.BUILD_TYPE}} --target SmartCharsetConverter CoreUnitTest
run: |
cmake --build --preset=default --config ${{env.BUILD_TYPE}} --target SmartCharsetConverter
cmake --build --preset=default --config ${{env.BUILD_TYPE}} --target CoreUnitTest
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --preset=default -C ${{env.BUILD_TYPE}}

# 只有在创建标签时才执行发布操作
release:
needs: build-and-test
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/')
runs-on: windows-latest

steps:
- name: Release
uses: softprops/action-gh-release@v2
with:
name: SmartCharsetConverter ${{github.ref_name}}
fail_on_unmatched_files: true
draft: true
files: |
D:\a\SmartCharsetConverter\build_SmartCharsetConverter\Release\SmartCharsetConverter.exe

0 comments on commit 23f12d9

Please sign in to comment.