Skip to content

Commit

Permalink
ci: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Aug 13, 2024
1 parent f3fdf8f commit 2614ae8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 35 deletions.
48 changes: 18 additions & 30 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ on:
jobs:
example-cxx:
runs-on: ubuntu-latest
env:
CXX_PROJECT_NAME: example-cxx
steps:
- uses: actions/checkout@v4
- name: Setup CookieCutter
run: pipx install cookiecutter

- name: Generate cxx example from template/cxx
uses: cargo-generate/cargo-generate-action@v0.20.0
with:
name: ${{ env.CXX_PROJECT_NAME }}
template: template/cxx
arguments: "--template-values-file .github/workflows/template_values.toml --verbose"
- name: Generate cxx example
run: cookiecutter --no-input --config-file .github/workflows/template_inputs_cxx.yml ./template/cxx

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }}
external_repository: x-pt/${{ env.CXX_PROJECT_NAME }}
external_repository: x-pt/example-cxx
publish_branch: main
publish_dir: ./${{ env.CXX_PROJECT_NAME }}
publish_dir: ./my-awesome-cxx-project
# Set exclude_assets to empty for including the .github directory to deployment assets.
exclude_assets: ''
enable_jekyll: true
Expand All @@ -34,25 +30,21 @@ jobs:
force_orphan: true
example-go:
runs-on: ubuntu-latest
env:
GO_PROJECT_NAME: example-go
steps:
- uses: actions/checkout@v4
- name: Setup CookieCutter
run: pipx install cookiecutter

- name: Generate go example from template/go
uses: cargo-generate/cargo-generate-action@v0.20.0
with:
name: ${{ env.GO_PROJECT_NAME }}
template: template/go
arguments: "--template-values-file .github/workflows/template_values.toml --verbose"
- name: Generate go example
run: cookiecutter --no-input --config-file .github/workflows/template_inputs_go.yml ./template/go

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }}
external_repository: x-pt/${{ env.GO_PROJECT_NAME }}
external_repository: x-pt/example-go
publish_branch: main
publish_dir: ./${{ env.GO_PROJECT_NAME }}
publish_dir: ./my-awesome-go-project
# Set exclude_assets to empty for including the .github directory to deployment assets.
exclude_assets: ''
enable_jekyll: true
Expand All @@ -62,25 +54,21 @@ jobs:
force_orphan: true
example-py:
runs-on: ubuntu-latest
env:
PY_PROJECT_NAME: example-py
steps:
- uses: actions/checkout@v4
- name: Setup CookieCutter
run: pipx install cookiecutter

- name: Generate python example from template/py
uses: cargo-generate/cargo-generate-action@v0.20.0
with:
name: ${{ env.PY_PROJECT_NAME }}
template: template/py
arguments: "--template-values-file .github/workflows/template_values.toml --verbose"
- name: Generate py example
run: cookiecutter --no-input --config-file .github/workflows/template_inputs_py.yml ./template/py

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }}
external_repository: x-pt/${{ env.PY_PROJECT_NAME }}
external_repository: x-pt/example-py
publish_branch: main
publish_dir: ./${{ env.PY_PROJECT_NAME }}
publish_dir: ./my-awesome-python-project
# Set exclude_assets to empty for including the .github directory to deployment assets.
exclude_assets: ''
enable_jekyll: true
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/template_inputs_cxx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ default_context:
full_name: X Author Name
email: x-pt@example.com
github_username: x-pt
project_name: My Awesome Project
project_slug: my-awesome-project
package_name: my_awesome_project
project_desc: A nice cxx project
cxx_cmake_version: "3.28"
project_name: My Awesome Cxx Project
project_slug: my-awesome-cxx-project
package_name: my_awesome_cxx_project
project_desc: A nice example project

# C++
cxx_cmake_version: 3.28
cxx_standard_version: 20
cxx_standard_required: true
cxx_extensions_required: false
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/template_inputs_go.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: My Awesome Go Project
project_slug: my-awesome-go-project
package_name: my_awesome_go_project
project_desc: A nice example project

# Go
go_version: 1.22
11 changes: 11 additions & 0 deletions .github/workflows/template_inputs_py.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: My Awesome Python Project
project_slug: my-awesome-python-project
package_name: my_awesome_python_project
project_desc: A nice example project

# Python
python_version: 3.11

0 comments on commit 2614ae8

Please sign in to comment.