diff --git a/README.md b/README.md index bc88dab..01a689e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ # jfrog-upload Upload build artifacts to JForg Artifactory generic registry. + +# Example of usage: +```bash +- name: 'Upload build artifacts - JFrog Artifactory' + uses: CoSMoSoftware/jfrog-upload@v0.0.1 + with: + access_token: ${{ secrets.< access_token | password > }} + user_name: ${{ secrets. }} + registry_url: "https://jfrog-sfo.dolby.net/artifactory/dolbyio-capi-generic-sfo/" + artefacts_patterns: | + ./build*/my-artefact-0.1.2-ubuntu20*.zip + ./build*/my-artefact-*-ubuntu20-dbgsym.zip + action_shell: # required only for powershell - bash is set as default. +``` diff --git a/action.yml b/action.yml index 46ae3b2..21f304f 100644 --- a/action.yml +++ b/action.yml @@ -15,17 +15,30 @@ inputs: required: false default: '*' action_shell: - required: false + description: 'Define shell for running python script' + required: true default: 'bash' runs: using: "composite" steps: - uses: actions/setup-python@v4 - if: ${{ runner.environment == 'github-hosted' }} + if: | + runner.environment == 'github-hosted' || + inputs.action_shell == 'powershell' with: python-version: '3.11' + - name: 'Install python deps for Windows' + if: inputs.action_shell == 'powershell' + run: python3 -m pip install requests ndg-httpsclient pyopenssl pyasn1 + shell: ${{ inputs.action_shell }} + + - name: 'Install python deps' + if: inputs.action_shell == 'bash' + run: python3 -m pip install requests pyopenssl + shell: ${{ inputs.action_shell }} + - name: 'Upload artefacts' run: | python3 ${{ github.action_path }}/artefacts2jfrog.py diff --git a/artefacts2jfrog.py b/artefacts2jfrog.py index 7c1985a..b3431f0 100644 --- a/artefacts2jfrog.py +++ b/artefacts2jfrog.py @@ -34,7 +34,7 @@ def upload_artefacts(file_path): file_name = os.path.split(file_path)[1] # add check of sha for downloads headers = {'content_type': 'application/octet-stream'} - jfrog_url_ = os.path.join(jfrog_url, file_name) + jfrog_url_ = jfrog_url + f"/{file_name}" with open(file_path, 'rb') as f: r = requests.put(jfrog_url_,