ci: use git version for packages
This commit is contained in:
committed by
Chris Rizzitello
parent
5cff026d7e
commit
3991fc0d25
9
.github/actions/get-version/action.yml
vendored
9
.github/actions/get-version/action.yml
vendored
@ -6,10 +6,9 @@ runs:
|
||||
|
||||
steps:
|
||||
- run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo "DESKFLOW_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
|
||||
echo "DESKFLOW_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
||||
if [[ "$GITHUB_REF" == *"tags/v"* ]]; then
|
||||
echo "DESKFLOW_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "DESKFLOW_VERSION=$(git describe --long | sed 's/-/./g;s/v//g' | grep -o '^[0-9]*.[0-9]*.[0-9]*.[0-9]*')">> $GITHUB_ENV
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -193,8 +193,11 @@ jobs:
|
||||
with:
|
||||
job: ${{ matrix.target.name }}
|
||||
|
||||
- name: Get version
|
||||
uses: ./.github/actions/get-version
|
||||
|
||||
- name: Package
|
||||
run: python ./scripts/package.py
|
||||
run: python ./scripts/package.py --package-version ${{env.DESKFLOW_VERSION}}
|
||||
env:
|
||||
WINDOWS_PFX_CERTIFICATE: ${{ secrets.WINDOWS_PFX }}
|
||||
WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASS }}
|
||||
@ -267,8 +270,11 @@ jobs:
|
||||
with:
|
||||
job: ${{ matrix.target.name }}
|
||||
|
||||
- name: Get version
|
||||
uses: ./.github/actions/get-version
|
||||
|
||||
- name: Package
|
||||
run: ./scripts/package.py
|
||||
run: ./scripts/package.py --package-version ${{env.DESKFLOW_VERSION}}
|
||||
env:
|
||||
APPLE_CODESIGN_ID: ${{ secrets.APPLE_CODESIGN_ID }}
|
||||
APPLE_P12_CERTIFICATE: ${{ secrets.APPLE_P12_CERTIFICATE }}
|
||||
@ -344,11 +350,14 @@ jobs:
|
||||
with:
|
||||
job: linux-${{ matrix.distro.name }}
|
||||
|
||||
- name: Get version
|
||||
uses: ./.github/actions/get-version
|
||||
|
||||
- name: Package
|
||||
env:
|
||||
LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }}
|
||||
LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }}
|
||||
run: ./scripts/package.py
|
||||
run: ./scripts/package.py --package-version ${{env.DESKFLOW_VERSION}}
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@ -31,11 +31,14 @@ DEFAULT_PROJECT_BUILD_DIR = "build"
|
||||
DEFAULT_DIST_DIR = "dist"
|
||||
DEFAULT_TEST_CMD = "deskflow-server --version"
|
||||
DEFAULT_PACKAGE_NAME = "deskflow"
|
||||
VERSION_FILE = "VERSION"
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--package-version",
|
||||
help="Set the Package Version",
|
||||
required=True)
|
||||
parser.add_argument(
|
||||
"--leave-test-installed",
|
||||
action="store_true",
|
||||
@ -47,36 +50,23 @@ def main():
|
||||
|
||||
package(
|
||||
DEFAULT_FILENAME_BASE,
|
||||
get_app_version(VERSION_FILE),
|
||||
DEFAULT_PROJECT_BUILD_DIR,
|
||||
DEFAULT_DIST_DIR,
|
||||
DEFAULT_TEST_CMD,
|
||||
DEFAULT_PRODUCT_NAME,
|
||||
DEFAULT_PACKAGE_NAME,
|
||||
version=args.package_version,
|
||||
leave_test_installed=args.leave_test_installed,
|
||||
)
|
||||
|
||||
|
||||
def get_app_version(filename):
|
||||
"""
|
||||
Returns the version either from the env var, or from the version file.
|
||||
"""
|
||||
version = env.get_env("DESKFLOW_VERSION", required=False)
|
||||
if version:
|
||||
return version
|
||||
|
||||
with open(filename, "r") as f:
|
||||
return f.read().strip()
|
||||
|
||||
|
||||
def package(
|
||||
filename_prefix,
|
||||
version,
|
||||
project_build_dir,
|
||||
dist_dir,
|
||||
test_cmd,
|
||||
product_name,
|
||||
package_name,
|
||||
version,
|
||||
source_dir=None,
|
||||
leave_test_installed=False,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user