2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-25 08:08:16 +00:00

fix pkg release pipeline (#11403)

* fix pkg release pipeline

* ammend version command

* fix release steps

* hardn version detection

* add doc string

* fix case

* use build-in env for security
This commit is contained in:
Matthias Mair
2026-02-22 21:18:39 +01:00
committed by GitHub
parent 3d5631d62c
commit fe921f2b8e
2 changed files with 25 additions and 3 deletions

View File

@@ -264,6 +264,7 @@ def main() -> bool:
# Determine which docker tag we are going to use
docker_tags: Optional[list[str]] = None
pkg_channel = None
if GITHUB_REF_TYPE == 'tag':
# GITHUB_REF should be of the form /refs/heads/<tag>
@@ -278,10 +279,14 @@ def main() -> bool:
docker_tags = [version_tag, 'stable'] if highest_release else [version_tag]
# Add release-line tag
pkg_channel = '.'.join(version_tag.split('.')[:2]) + '.x'
elif GITHUB_REF_TYPE == 'branch':
# Otherwise we know we are targeting the 'master' branch
docker_tags = ['latest']
highest_release = False
pkg_channel = GITHUB_BASE_REF
else:
print('Unsupported branch / version combination:')
@@ -310,6 +315,8 @@ def main() -> bool:
if GITHUB_REF_TYPE == 'tag' and highest_release:
env_file.write('stable_release=true\n')
env_file.write(f'pkg_channel={pkg_channel}\n')
return True

View File

@@ -146,7 +146,9 @@ jobs:
if: github.repository == 'inventree/InvenTree'
name: ${{ matrix.target }}
runs-on: ubuntu-latest
needs: [build, docs]
needs: [build]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
@@ -171,6 +173,8 @@ jobs:
BRANCH: ${{ github.event.release.target_commitish }}
TARGET: ${{github.event.release.target_commitish}}
REPO: ${{ github.repository }}
VERSION_REF: ${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: |
# Get info
@@ -202,6 +206,17 @@ jobs:
# Move frontend build into place
mkdir -p src/backend/InvenTree/web/static
unzip -qq frontend-build.zip -d src/backend/InvenTree/web/static/web
echo "INFO write release_version"
echo "VERSION=$VERSION_REF" >> $GITHUB_OUTPUT
echo "REF=$GITHUB_REF" >> $GITHUB_OUTPUT
# Disable before.sh for now - will need to be removed once we switch to go.packager.io fully
echo "#!/bin/bash" > contrib/packager.io/before.sh
echo "calculate release channel"
pip install --require-hashes -r contrib/dev_reqs/requirements.txt
python3 .github/scripts/version_check.py
- name: Package
uses: pkgr/action/package@c5666febcd31750da6428042193fc5b2fb765435 # pin@main
id: package
@@ -225,8 +240,8 @@ jobs:
with:
target: ${{ matrix.target }}
token: ${{ secrets.PACKAGER_RELEASE_TOKEN }}
repository: inventree/inventree
channel: ${{ github.ref_name }}
repository: inventree/InvenTree
channel: ${{ env.pkg_channel }}
file: ${{ steps.package.outputs.package_path }}
- name: Publish to artifact
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3