Skip to content

Commit

Permalink
feat: add release_directory parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan authored Nov 1, 2023
1 parent bab8541 commit 2cc9017
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/pragma_module_info.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"name": "{{ tmplr.name }}",
"module_name": "{{ tmplr.module_name }}",
"install_directory": "{{ tmplr.install_directory }}"
"release_directory": "{{ tmplr.release_directory }}"
}
9 changes: 7 additions & 2 deletions .github/workflows/build-linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ jobs:
- name: Create Release Files
shell: bash
run: |
mkdir -p release/${{ steps.module-info.outputs.install_directory }}
cp "${{ steps.build-module.outputs.install-dir }}/modules/lib${{ steps.module-info.outputs.module_name }}.so" "release/${{ steps.module-info.outputs.install_directory }}"
if [ -n "${{ steps.module-info.outputs.release_directory }}" ]; then
mkdir -p "release/${{ steps.module-info.outputs.release_directory }}"
cp -r "${{ steps.build-module.outputs.install-dir }}/${{ steps.module-info.outputs.release_directory }}" "release/${{ steps.module-info.outputs.release_directory }}"
else
mkdir -p "release/${{ steps.module-info.outputs.install_directory }}"
cp "${{ steps.build-module.outputs.install-dir }}/${{ steps.module-info.outputs.install_directory }}lib${{ steps.module-info.outputs.module_name }}.so" "release/${{ steps.module-info.outputs.install_directory }}"
fi
- name: Release Binaries
uses: Silverlan/common_actions/release_nightly_binaries@main
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/build-windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ jobs:
- name: Create Release Files
shell: bash
run: |
mkdir -p release/${{ steps.module-info.outputs.install_directory }}
cp "${{ steps.build-module.outputs.install-dir }}/modules/${{ steps.module-info.outputs.module_name }}.dll" "release/${{ steps.module-info.outputs.install_directory }}"
if [ -n "${{ steps.module-info.outputs.release_directory }}" ]; then
mkdir -p "release/${{ steps.module-info.outputs.release_directory }}"
cp -r "${{ steps.build-module.outputs.install-dir }}/${{ steps.module-info.outputs.release_directory }}" "release/${{ steps.module-info.outputs.release_directory }}"
else
mkdir -p "release/${{ steps.module-info.outputs.install_directory }}"
cp "${{ steps.build-module.outputs.install-dir }}/${{ steps.module-info.outputs.install_directory }}${{ steps.module-info.outputs.module_name }}.dll" "release/${{ steps.module-info.outputs.install_directory }}"
fi
- name: Release Binaries
uses: Silverlan/common_actions/release_nightly_binaries@main
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
name: ${{ steps.module-info.outputs.name }}
module_name: ${{ steps.module-info.outputs.module_name }}
install_directory: ${{ steps.module-info.outputs.install_directory }}
release_directory: ${{ steps.module-info.outputs.release_directory }}
git_url: https://github.com/${{ github.repository }}.git
github_url: https://github.com/${{ github.repository }}

Expand Down
7 changes: 7 additions & 0 deletions .tmplr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ steps:
fallback:
prompt: "Where should the module be installed to? Default: \"modules/\""

- read: release_directory
from: env.release_directory
fallback:
from: git.release_directory
fallback:
prompt: "The directory that should be used for GitHub releases."

- read: git_url
from: env.git_url
fallback:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This is a template repository for modules for the Pragma Game Engine. If you wan
Once the repository has been generated, enable the "Read and Write" workflow permissions in the settings of the repository. Then, edit the values in `template_pragma_module.json`:
* name: The name of the module as it will appear in the readme
* module_name: The internal name of the module (i.e. the name of the CMake target and the binaries). This name should always start with the prefix `pr_` and always be lowercase.
* install_directory: The directory where the module should be installed to, relative to the Pragma installation. This should be somewhere in `modules/`.
* install_directory: The directory where the module should be installed to, relative to the Pragma installation. This should be somewhere in `modules/` or `addons/<addonName>/modules/`.
* release_directory (optional): The directory that should be used for GitHub releases. If left empty, only the binary module itself will be added to the release. If your binary resides within an addon, specify the addon path here (`addons/<addonName>/`).

Once you have pushed the changes to this file, a GitHub workflow will be triggered, which will generate the final files (this may take a few minutes). This will also replace this readme with additional information and instructions.
5 changes: 5 additions & 0 deletions github_actions/get_module_info/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ outputs:
install_directory:
description: 'Where the module should be installed to.'
value: ${{ steps.json.outputs.install_directory }}
release_directory:
description: 'The directory that should be added to the GitHub release.'
value: ${{ steps.json.outputs.release_directory }}
runs:
using: "composite"
steps:
Expand All @@ -40,10 +43,12 @@ runs:
name=$( getVal '.name' )
module_name=$( getVal '.module_name' )
install_directory=$( getVal '.install_directory' )
release_directory=$( getVal '.release_directory' )
echo "name=$name" >> $GITHUB_OUTPUT
echo "module_name=$module_name" >> $GITHUB_OUTPUT
echo "install_directory=$install_directory" >> $GITHUB_OUTPUT
echo "release_directory=$release_directory" >> $GITHUB_OUTPUT
if [ "$remFile" -eq "1" ]; then
rm -f "$filepath"
Expand Down
3 changes: 2 additions & 1 deletion template_pragma_module.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Project Name",
"module_name": "pr_module",
"install_directory": "modules/"
"install_directory": "modules/",
"release_directory": ""
}

0 comments on commit 2cc9017

Please sign in to comment.