Skip to content

Commit

Permalink
ci: build xmake and cmake example
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Aug 23, 2024
1 parent 5d1a541 commit d295be9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ default_context:
full_name: X Author Name
email: x-pt@example.com
github_username: x-pt
project_name: Example Cxx
project_slug: example-cxx
package_name: example_cxx
project_name: Example Cxx CMake
project_slug: example-cxx-cmake
package_name: example_cxx_cmake
project_desc: A nice example project

# C++
Expand Down
11 changes: 11 additions & 0 deletions .github/configs/template_inputs_cxx_xmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default_context:
full_name: X Author Name
email: x-pt@example.com
github_username: x-pt
project_name: Example Cxx XMake
project_slug: example-cxx-xmake
package_name: example_cxx_xmake
project_desc: A nice example project

# C++
cxx_build_tool: xmake
22 changes: 18 additions & 4 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
name: Synchronize the example with the template

on:
push:
branches: [ main ]

jobs:
example-cxx:
runs-on: ubuntu-latest
strategy:
matrix:
config:
- name: cxx-cmake
config_file: .github/configs/template_inputs_cxx_cmake.yml
publish_dir: example-cxx-cmake
repo_name: x-pt/example-cxx-cmake
- name: cxx-xmake
config_file: .github/configs/template_inputs_cxx_xmake.yml
publish_dir: example-cxx-xmake
repo_name: x-pt/example-cxx-xmake

steps:
- uses: actions/checkout@v4

- name: Setup CookieCutter
run: pipx install cookiecutter

- name: Generate cxx example
run: cookiecutter --no-input --config-file .github/configs/template_inputs_cxx.yml ./template/cxx
run: cookiecutter --no-input --config-file ${{ matrix.config.config_file }} ./template/cxx

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }}
external_repository: x-pt/example-cxx
external_repository: ${{ matrix.config.repo_name }}
publish_branch: main
publish_dir: ./example-cxx
# Set exclude_assets to empty for including the .github directory to deployment assets.
publish_dir: ./${{ matrix.config.publish_dir }}
exclude_assets: ''
enable_jekyll: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
full_commit_message: "ci: :art: Cxx Sample"
force_orphan: true

example-go:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ cookiecutter gh:x-pt/template

Check out an example project generated with this template:

- [Example C++](https://github.com/x-pt/example-cxx)
- [Example C++ with CMake](https://github.com/x-pt/example-cxx-cmake)
- [Example C++ with XMake](https://github.com/x-pt/example-cxx-xmake)
- [Example Golang](https://github.com/x-pt/example-go)
- [Example Python](https://github.com/x-pt/example-py)

Expand Down

0 comments on commit d295be9

Please sign in to comment.