Skip to content

Commit

Permalink
add optional 'directory' argument (and add ci test) (#2)
Browse files Browse the repository at this point in the history
* add optional 'directory' argument (and add ci test)

* add option table
  • Loading branch information
andy5995 authored Oct 8, 2022
1 parent e1f3658 commit 202ce2a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test Action

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
MOD_NAME: community-maps-2

jobs:
build-pyromod:
runs-on: ubuntu-latest
env:
MOD_VERSION: ${{ github.sha }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: 0ad-matters/gh-action-build-pyromod@v1
with:
name: ${{ env.MOD_NAME }}
version: ${{ env.MOD_VERSION }}
directory: 'test/${{ env.MOD_NAME }}'
id: build-pyromod
- uses: 0ad-matters/gh-action-build-pyromod@trunk
with:
name: ${{ env.MOD_NAME }}
version: ${{ env.MOD_VERSION }}
directory: 'test/${{ env.MOD_NAME }}'
id: build-pyromod
#- name: Upload Artifacts
## Uploads artifacts (combined into a zip file) to the workflow output page
#uses: actions/upload-artifact@v3
#with:
#name: ${{ env.MOD_NAME }}-${{ env.MOD_VERSION }}
#path: "output/${{ env.MOD_NAME }}*.*"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test/community-maps-2"]
path = test/community-maps-2
url = https://github.com/0ad-matters/community-maps-2
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2022-10-08

* Add optional 'directory' argument

2022-10-07

* Use proper versioning
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,18 @@ jobs:
omitBodyDuringUpdate: True
```
## Option table
| name | required | default |
|----------|--------|------|
| name | true | '' |
| version | true | '' |
| directory (where mod.json is located | false | '.' |
## Additional Notes
Option table
The docker image used by this action is published from
[0ad-matters/0ad-bin-nodata](https://github.com/0ad-matters/0ad-bin-nodata)
and pulled from
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: "mod version"
required: true
default: ''
directory:
description: "relative path to your mod.json file"
required: false
default: '.'

runs:
using: docker
Expand Down
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/bash
set -ev

if [ -z "$INPUT_DIRECTORY" ]; then
INPUT_DIRECTORY="."
fi

OUTPUT_DIR=/github/workspace/output
mkdir -m 777 -p $OUTPUT_DIR
OUTPUT_FILE="$OUTPUT_DIR/$INPUT_NAME-$INPUT_VERSION.pyromod"

# pyrogenesis won't run this as root
su user0ad --command "/home/user0ad/usr/bin/pyrogenesis \
-mod=package_mod \
-archivebuild=$PWD \
-archivebuild=$INPUT_DIRECTORY \
-archivebuild-output=$OUTPUT_FILE \
-archivebuild-compress"

Expand Down
1 change: 1 addition & 0 deletions test/community-maps-2
Submodule community-maps-2 added at 235dd1

0 comments on commit 202ce2a

Please sign in to comment.