forked from MrStonedOne/byond-client-compatibility-check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
60 lines (52 loc) · 3.14 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: 'Byond Client Compatibility Check'
description: "Github action to confirm that the required client version of byond world (.dmb) isn't higher than expected."
inputs:
dmb-location:
description: 'File location of the compiled byond world dmb to check.'
required: true
max-required-client-version:
description: 'Highest allowed dreamseeker major version that can be required by the compiled byond world. Leave empty if you just want the output'
required: false
default: 9999
outputs:
required-client-version:
description: 'The detected client compatibility version'
value: ${{ steps.fetch-required-client-version.outputs.required-client-version }}
runs:
using: "composite"
steps:
- name: 'Validate inputs.max-required-client-version'
id: validate-max-required-client-version
shell: bash
run: '(( ${{ inputs.max-required-client-version }} ))'
if: 'inputs.max-required-client-version != 9999'
- name: 'Input validation error message'
id: validate-max-required-client-version-error-message
if: "failure() && steps.validate-max-required-client-version.outcome == 'failure'"
shell: bash
run: "echo '::error ::Invalid max-required-client-version passed to Byond Client Compatibility Check: `${{ toJSON(inputs.max-required-client-version) }}`'"
- name: 'Extract client compatibility version from dmb'
id: fetch-required-client-version
shell: bash
run: 'echo "required-client-version=$(( $( head -n2 ${{ inputs.dmb-location }} | tail -n1 | cut -d " " -f 4 ) ))" >> $GITHUB_OUTPUT'
- name: '.dmb parse error check'
id: dmb-parse-error-check
if: "(steps.fetch-required-client-version.outputs.required-client-version == '' || steps.fetch-required-client-version.outputs.required-client-version == null)"
shell: bash
run: 'echo "Empty value";exit 1'
- name: '.dmb parse error message'
id: dmb-parse-error-message
if: "failure() && (steps.fetch-required-client-version.outcome == 'failure' || steps.dmb-parse-error-check.outcome == 'failure')"
shell: bash
run: 'echo "::error file=${{ inputs.dmb-location }},line=1,endline=2::Error parsing dmb for required client version"'
- name: 'Check required client version is not higher then allowed max.'
id: check-required-client-version
shell: bash
#this still uses bash instead of an if: and echo purely so that it can't support floats.
run: (( ${{ steps.fetch-required-client-version.outputs.required-client-version }} <= ${{ inputs.max-required-client-version }} ))
if: 'inputs.max-required-client-version != 9999'
- name: 'Version validation error message'
id: check-required-client-version-error
if: "failure() && steps.check-required-client-version.outcome == 'failure'"
shell: bash
run: 'echo "::error file=${{ inputs.dmb-location }},line=2,endline=2::Byond world ${{ inputs.dmb-location }} requires client version ${{ steps.fetch-required-client-version.outputs.required-client-version }} which is higher than the allowed max required client version of ${{ inputs.max-required-client-version }}."'