From 18e8e4cb78d02e0f6fa4a5b43bbd387e796006fc Mon Sep 17 00:00:00 2001 From: pthierry Date: Thu, 19 Sep 2024 16:23:47 +0200 Subject: [PATCH] moving to reusable workflow --- .github/workflows/publish-to-jfrog.yml | 70 +++++--------------------- 1 file changed, 13 insertions(+), 57 deletions(-) diff --git a/.github/workflows/publish-to-jfrog.yml b/.github/workflows/publish-to-jfrog.yml index e9239ec..aa9c3ac 100644 --- a/.github/workflows/publish-to-jfrog.yml +++ b/.github/workflows/publish-to-jfrog.yml @@ -5,67 +5,23 @@ name: Upload Python Package to jfrog on: - release: - types: [released] + push: + branches: + - main workflow_dispatch: jobs: - deploy: - runs-on: outpost-os-shared-small - environment: ledger-publish - + pubhlish: permissions: id-token: write contents: read attestations: write - - steps: - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install build basics - run: | - pip install build wheel-filename blob - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - - name: build package - run: python3 -m build . --sdist --wheel - - name: get back local build version - id: get_pkg_version - run: | - from wheel_filename import parse_wheel_filename - import glob - import os - from random import choices - from string import ascii_letters - - whl = str(glob.glob('dist/*.whl')[0]); - pwf = parse_wheel_filename('dist/' + whl); - with open(os.environ["GITHUB_OUTPUT"], "a") as gh_output: - delimiter = "".join(choices(ascii_letters, k=16)) - gh_output.writelines([ - f"pkg_version<<{delimiter}\n", - f"{pwf.version}\n", - delimiter + "\n", - ]) - shell: python - - name: Login to JFrog Ledger - uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1 - - name: upload package - run: jf rt u --build-name=dts-util-devel --build-number=1 --module=dts-utils 'dist/*.tar.gz' 'outpost-pypi-dev-green/outpost-pypi-dev-green/' - - name: Attest - id: attest - uses: LedgerHQ/actions-security/actions/attest@actions/attest-1 - with: - subject-path: 'dist/*.tar.gz' - push-to-registry: false - - name: set jfrog Repo URL - run: jf pipc --global --repo-resolve=outpost-pypi-virtual-green - - name: test install from jfrog - run: | - jf pip install dts-utils==${{ steps.get_pkg_version.outputs.pkg_version }} - pip show dts-utils + environment: ledger-publish + uses: outpost-os/pipeline-python/.github/workflows/publish.yml@main + with: + runner: outpost-os-shared-small + python-version: 3.10 + build-name: dts-utils-dev + module-name: dts-utils + repo-name: outpost-pypi-dev-green + virtual-repo-name: outpost-pypi-virtual-green