Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
fix: initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
ArwynFr committed Sep 8, 2022
1 parent 6a10a73 commit f9c6337
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/USAGE.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
= Github Actions: Sign Arma 3 Mod: Usage
:toc: preamble

This document describes how to use the `team-gsri/actions-sign-mod` Github action.

== Requirements and limitations

This action requires :

* Arma 3 Tools
* Powershell 7+

CAUTION: **This action can only be used on Windows runners** and requires installation of the Arma 3 Tools. This requires you to agree to the Steam EULA, Arma 3 EULA, and BI Tools EULA. You can install the arma 3 tools using steamcmd.

== Installation

* Download and install https://store.steampowered.com/app/233800/Arma_3_Tools/[Arma 3 Tools]
* Set a machine environment variable `ARMA3TOOLS` with the path to the tools directory

TIP: You can also use https://developer.valvesoftware.com/wiki/SteamCMD[Steamcmd] to download, install, and update the Arma 3 Tools without the Steam client. In both case, you need a valid steam account with subscription to the Arma 3 Tools in order to accept EULAs, but you don't need to own the game itself.

== Inputs

=== `target`

**Required.** Path to a directory containing the mod files to sign, relative to the repository root.

=== `keyname`

**Required.** Name of the Bohemia Interactive authority used for signature. Recommended to include TAG, mod name, and version.

== Outputs

*There is no output*

== Example

This example will sign content of `mod/gsri-gear` using a key named GSRI-Gear-1.0.1:

```yml
uses: team-gsri/[email protected]
with:
target: 'mod/gsri-gear'
keyname: 'GSRI-Gear-1.0.1'
```
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: release

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'action.yml'
- 'functions/**'

jobs:
release:
runs-on: ubuntu-latest
name: 'Publish a new release'
steps:

- uses: arwynfr/[email protected]
with:
pattern: ''
27 changes: 27 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
= Github Actions: Sign Arma 3 Mod

This action creates a BI key and signs a mod, using Arma 3 Tools.

CAUTION: **This action can only be used on Windows runners** and requires installation of the Arma 3 Tools. This requires you to agree to the Steam EULA, Arma 3 EULA, and BI Tools EULA. You can install the arma 3 tools using steamcmd.

== Usage and contributing

* See link:.github/USAGE.adoc[usage guide] for details

== Rules and standards

The following documents provide additional informations on rules and standards applying to this project :

* link:LICENSE[MIT License]
* https://www.bohemia.net/community/licenses/bohemia-interactives-tools-end-user-license[BI Tools EULA]
* https://www.bohemia.net/community/licenses/arma3-end-user-license[BI Arma 3 EULA]
* https://github.com/team-gsri/.github/blob/master/CODE_OF_CONDUCT.md[GSRI Code of conduct]
* https://github.com/team-gsri/.github/blob/master/SECURITY.md[GSRI Security policy]
* https://github.com/team-gsri/.github/blob/master/SUPPORT.md[GSRI Support policy]
* https://github.com/team-gsri/.github/blob/master/CONTRIBUTING.md[GSRI Contribution guide]

== Disclaimer

This application or website is not affiliated or authorized by Bohemia Interactive a.s. Bohemia Interactive, ARMA, DAYZ and all associated logos and designs are trademarks or registered trademarks of Bohemia Interactive a.s.

The GSRI logo is a trademark of GSRI.
27 changes: 27 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Sign Arma 3 mods'
description: 'Creates a BI key and signs a mod using Arma 3 Tools'
author: ArwynFr
branding:
icon: award
color: gray-dark
inputs:

target:
description: 'Path to the directory that is the mod root'
required: true

keyname:
description: 'Name of the authority for key pair creation'
required: true

runs:
using: "composite"
steps:

- shell: pwsh
run: |
$ActionArgs = @{
ModPath = '${{ inputs.target }}'
KeyName = '${{ inputs.keyname }}'
}
${{ github.action_path }}/functions/Sign-Directory.ps1 @ActionArgs
52 changes: 52 additions & 0 deletions functions/Sign-Directory.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateScript({ Test-Path $_ -PathType Container || Throw '-ModPath must be a directory' })]
[string]
$ModPath,

[Parameter(Mandatory)]
[string]
$KeyName,

[Parameter()]
[ValidateScript({ Test-Path $_ -PathType Container || Throw '-ArmaToolsPath must be a directory' })]
[string]
$ArmaToolsPath = ${env:ARMA3TOOLS}
)

Begin {
# Verify DSCreateKey is found
$dsCreateKeyExe = Join-Path -Path ${ArmaToolsPath} -ChildPath 'DSSignFile/DSCreateKey.exe'
if (-Not (Test-Path -Path $dsCreateKeyExe -PathType Leaf)) {
Throw 'DSCreateKey.exe not found'
}

# Verify DSSignFile is found
$dsSignExe = Join-Path -Path ${ArmaToolsPath} -ChildPath 'DSSignFile/DSSignFile.exe'
if (-Not (Test-Path -Path $dsSignExe -PathType Leaf)) {
Throw 'DSSignFile.exe not found'
}
}

Process {
# Create key pair
& $dsCreateKeyExe ${KeyName}
$publicKey = ./${KeyName}.bikey
$privateKey = ./${KeyName}.biprivatekey
Test-Path $publicKey -PathType Leaf || Test-Path $privateKey -PathType Leaf || Throw 'Keypair creation failed'

# Sign pbo files
Get-ChildItem ${ModPath} -Filter *.pbo -Recurse | ForEach-Object {
& $dsSignExe $privateKey $_.FullName
}

# Copy public key
New-Item -ItemType 'directory' ${ModPath}/keys -Force | Out-Null
Move-Item $publicKey ${ModPath}/keys
}

End {
# Force delete private key
Remove-Item $privateKey -Force
}

0 comments on commit f9c6337

Please sign in to comment.