-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
53 lines (52 loc) · 1.53 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
name: 'Godot Build Info'
branding:
icon: 'info'
color: 'blue'
description: 'Add version and other info at build time for Godot Engine projects'
inputs:
version: # id of input
description: 'package version'
required: false
commit: # id of input
description: 'commit hash'
required: false
build_date: # id of input
description: 'Date/Time when the package was built'
required: false
file: # id of input
description: 'File to add the overrides'
required: true
default: override.cfg
runs:
using: "composite"
steps:
- name: Set Parameters
shell: bash
env:
COMMIT: ${{ inputs.commit }}
BUILD_DATE: ${{ inputs.build_date }}
run: |-
if [ -z "${COMMIT}" ]; then
echo "commit=${GITHUB_SHA}" >> $GITHUB_ENV
else
echo "commit=${COMMIT}" >> $GITHUB_ENV
fi
if [ -z "${BUILD_DATE}" ]; then
echo "build_date=$(date +'%Y/%m/%d %H:%M:%S')" >> $GITHUB_ENV
else
echo "build_date=${BUILD_DATE}" >> $GITHUB_ENV
fi
- name: Set Settings Override
shell: bash
env:
FILE: ${{ inputs.file }}
VERSION: ${{ inputs.version }}
COMMIT: ${{ env.commit }}
BUILD_DATE: ${{ env.build_date }}
run: |-
echo "[build_info]" > "${FILE}"
echo "package/version=\"${VERSION}\"" >> "${FILE}"
echo "package/build_date=\"${BUILD_DATE}\"" >> "${FILE}"
echo "source/commit=\"${COMMIT}\"" >> "${FILE}"
echo "-- ${FILE} --"
cat "${FILE}"