kopia lustrzana https://github.com/meshtastic/protobufs
Github action for automated tagging (release)
rodzic
5ddb7cbbe7
commit
1da871fb2f
|
@ -6,10 +6,12 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -20,3 +22,52 @@ jobs:
|
||||||
uses: plexsystems/protolint-action@v0.2.0
|
uses: plexsystems/protolint-action@v0.2.0
|
||||||
with:
|
with:
|
||||||
configDirectory: .
|
configDirectory: .
|
||||||
|
|
||||||
|
release:
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- name: Cache python libs
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache-pip # needed in if test
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: ${{ runner.os }}-pip
|
||||||
|
|
||||||
|
- name: Upgrade python tools
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
|
||||||
|
- name: Get release version string
|
||||||
|
run: echo "version=$(./scripts/buildinfo.py short)" >> $GITHUB_OUTPUT
|
||||||
|
id: version
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
id: create_release
|
||||||
|
with:
|
||||||
|
release_name: Meshtastic Protobufs ${{ steps.version.outputs.version }}
|
||||||
|
tag_name: v${{ steps.version.outputs.version }}
|
||||||
|
body: Protobufs for version ${{ steps.version.outputs.version }} release of Meshtastic firmware
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Bump version.properties
|
||||||
|
run: >-
|
||||||
|
scripts/bump_version.py
|
||||||
|
|
||||||
|
- name: Create version.properties pull request
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
add-paths: |
|
||||||
|
version.properties
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import configparser
|
||||||
|
import sys
|
||||||
|
from readprops import readProps
|
||||||
|
|
||||||
|
verObj = readProps('version.properties')
|
||||||
|
propName = sys.argv[1]
|
||||||
|
print(f"{verObj[propName]}")
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""Bump the version number"""
|
||||||
|
|
||||||
|
lines = None
|
||||||
|
|
||||||
|
with open('version.properties', 'r', encoding='utf-8') as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
|
||||||
|
with open('version.properties', 'w', encoding='utf-8') as f:
|
||||||
|
for line in lines:
|
||||||
|
if line.lstrip().startswith("build = "):
|
||||||
|
words = line.split(" = ")
|
||||||
|
ver = f'build = {int(words[1]) + 1}'
|
||||||
|
f.write(f'{ver}\n')
|
||||||
|
else:
|
||||||
|
f.write(line)
|
|
@ -0,0 +1,35 @@
|
||||||
|
import subprocess
|
||||||
|
import configparser
|
||||||
|
import traceback
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def readProps(prefsLoc):
|
||||||
|
"""Read the version of our project as a string"""
|
||||||
|
|
||||||
|
config = configparser.RawConfigParser()
|
||||||
|
config.read(prefsLoc)
|
||||||
|
version = dict(config.items('VERSION'))
|
||||||
|
verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]),
|
||||||
|
long = "unset")
|
||||||
|
|
||||||
|
# Try to find current build SHA if if the workspace is clean. This could fail if git is not installed
|
||||||
|
try:
|
||||||
|
sha = subprocess.check_output(
|
||||||
|
['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip()
|
||||||
|
isDirty = subprocess.check_output(
|
||||||
|
['git', 'diff', 'HEAD']).decode("utf-8").strip()
|
||||||
|
suffix = sha
|
||||||
|
if isDirty:
|
||||||
|
# short for 'dirty', we want to keep our verstrings source for protobuf reasons
|
||||||
|
suffix = sha + "-d"
|
||||||
|
verObj['long'] = "{}.{}.{}.{}".format(
|
||||||
|
version["major"], version["minor"], version["build"], suffix)
|
||||||
|
except:
|
||||||
|
# print("Unexpected error:", sys.exc_info()[0])
|
||||||
|
# traceback.print_exc()
|
||||||
|
verObj['long'] = verObj['short']
|
||||||
|
|
||||||
|
# print("firmware version " + verStr)
|
||||||
|
return verObj
|
||||||
|
# print("path is" + ','.join(sys.path))
|
|
@ -0,0 +1,4 @@
|
||||||
|
[VERSION]
|
||||||
|
major = 2
|
||||||
|
minor = 0
|
||||||
|
build = 12
|
Ładowanie…
Reference in New Issue