1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

Include .gitversion in linux archive

This commit is contained in:
David Muckle 2023-12-23 20:20:00 -05:00
parent b0b9113e51
commit e6e49d4601
2 changed files with 19 additions and 7 deletions

View File

@ -1,5 +1,5 @@
# vim: tabstop=2 shiftwidth=2 # vim: tabstop=2 shiftwidth=2
name: Build EDMC for Windows name: Build EDMC
on: on:
push: push:
@ -11,7 +11,7 @@ jobs:
variables: variables:
outputs: outputs:
sem_ver: ${{ steps.var.outputs.sem_ver }} sem_ver: ${{ steps.var.outputs.sem_ver }}
archive_exclusions: ${{ steps.var.outputs.archive_exclusions }} short_sha: ${{ steps.var.outputs.short_sha }}
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- name: Setting global variables - name: Setting global variables
@ -20,6 +20,7 @@ jobs:
with: with:
script: | script: |
core.setOutput('sem_ver', '${{ github.ref_name }}'.replaceAll('Release\/', '')) core.setOutput('sem_ver', '${{ github.ref_name }}'.replaceAll('Release\/', ''))
core.setOutput('short_sha', '${{ github.sha }}'.substring(0, 7))
linux_build: linux_build:
needs: [variables] needs: [variables]
@ -29,6 +30,9 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- name: Create .gitversion
run: |
echo "${{ needs.variables.outputs.short_sha }}" > ../.gitversion
- name: Make tar archive - name: Make tar archive
run: | run: |
@ -40,7 +44,10 @@ jobs:
--exclude=EDMarketConnector-release-*.* \ --exclude=EDMarketConnector-release-*.* \
--exclude=.editorconfig \ --exclude=.editorconfig \
--exclude=.flake8 \ --exclude=.flake8 \
--exclude=.git* \ --exclude=.gitattribues \
--exclude=.gitignore \
--exclude=.gitmodules \
--exclude=.git \
--exclude=.mypy.ini \ --exclude=.mypy.ini \
--exclude=.pre-commit-config.yaml \ --exclude=.pre-commit-config.yaml \
--exclude=build.py \ --exclude=build.py \

View File

@ -137,10 +137,15 @@ def appversion() -> semantic_version.Version:
shorthash = gitv.read() shorthash = gitv.read()
else: else:
# Running from source # Running from source. For Linux, check to see if .gitversion file exists
shorthash = git_shorthash_from_head() # If so, use it. This is also required for the Flatpak
if shorthash is None: if pathlib.Path("./" + GITVERSION_FILE).is_file:
shorthash = 'UNKNOWN' with open(pathlib.Path("./" + GITVERSION_FILE)) as gitv:
shorthash = gitv.read()
else:
shorthash = git_shorthash_from_head()
if shorthash is None:
shorthash = 'UNKNOWN'
_cached_version = semantic_version.Version(f'{_static_appversion}+{shorthash}') _cached_version = semantic_version.Version(f'{_static_appversion}+{shorthash}')
return _cached_version return _cached_version