Files
Techmino/.github/actions/update-version/action.yml
Imple Lee d75b709f23 Move Python code from updateVersion.py into action.ymls directly (#423)
* test python3

* try use `python` instead of `python3`

* use `update-version` everywhere

* fix variable injection

* fix python2vs3

* move `updateVersion.py` into action files
2021-11-01 02:12:32 +08:00

34 lines
1.0 KiB
YAML

name: 'update version'
description: 'common update logic for snapshot and release'
inputs:
commit:
required: false
type:
required: true
runs:
using: "composite"
steps:
- shell: python
name: update snapshot saving folder
run: |
from io import open
if '${{ inputs.type }}'.lower() != 'snapshot':
exit(0)
with open('conf.lua', 'r+', encoding='utf-8') as file:
data = file.read()
data = data.replace("t.identity='Techmino'--Saving folder", "t.identity='Techmino_Snapshot'--Saving folder")
file.seek(0)
file.truncate()
file.flush()
file.write(data)
- shell: python
run: |
from io import open
with open('version.lua', 'r+', encoding='utf-8') as file:
data = file.read()
data = data.replace('@DEV', '@${{ inputs.commit }}'[0:4] if '${{ inputs.commit }}' != '' else '')
file.seek(0)
file.truncate()
file.flush()
file.write(data)