GitHub Action
Build a 0ad pyromod file
This is a GitHub Action that will build a 0ad pyromod.
This action requires that the root directory of your mod is in your repository root (i.e., your 'mod.json' is located in the repository root).
The example shown below has two separate jobs:
-
When there is a push to the default branch, or when a pull request is opened or updated, the pyromod is built and is uploaded to the workflow output page.
-
When a new a new tag is created (if the tag starts with a 'v'), the built mod will get uploaded to the release page, along with a corresponding sha256sum.
This file needs to be placed in
<your_repo_root>/.github/workflows/<filename>.yml
(where <filename>
can be anything you like)
The release action used in the example below is a separate action (not maintained by this project) and can be replaced by a different release action if you like.
name: Build Pyromod
on:
push:
branches:
- main
tags:
- v**
pull_request:
branches:
- main
env:
MOD_NAME: <your-mod>
jobs:
build-pyromod:
if: ${{ github.ref_type != 'tag' }}
runs-on: ubuntu-latest
env:
MOD_VERSION: ${{ github.sha }}
steps:
- uses: actions/checkout@v3
- uses: 0ad-matters/gh-action-build-pyromod@v1
with:
name: ${{ env.MOD_NAME }}
version: ${{ env.MOD_VERSION }}
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 }}*.*"
release-pyromod:
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
env:
MOD_NAME: ${{ github.repository }}
MOD_VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Massage Variables
run: |
echo "MOD_VERSION=${MOD_VERSION:1}" >> $GITHUB_ENV
- uses: 0ad-matters/gh-action-build-pyromod@v1
with:
name: ${{ env.MOD_NAME }}
version: ${{ env.MOD_VERSION }}
id: build-pyromod
- name: Create sha256sum
run: |
OUTPUT_FILE="$MOD_NAME-$MOD_VERSION.pyromod"
cd output
sha256sum $OUTPUT_FILE > $OUTPUT_FILE.sha256sum
- name: Release PyroMod
uses: ncipollo/release-action@v1
with:
allowUpdates: True
prerelease: False
artifacts: "output/${{ env.MOD_NAME }}*.*"
token: ${{ secrets.GITHUB_TOKEN }}
omitNameDuringUpdate: True
omitBodyDuringUpdate: True
name | required | default |
---|---|---|
name | true | '' |
version | true | '' |
directory (where mod.json is located | false | '.' |
Option table
The docker image used by this action is published from 0ad-matters/0ad-bin-nodata and pulled from andy5995/0ad-bin-nodata.