Skip to content

Commit

Permalink
Fix windows urllib error
Browse files Browse the repository at this point in the history
  • Loading branch information
msobo1 committed Oct 30, 2023
1 parent 89b37cf commit a2e6788
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
access_token: ${{ secrets.< access_token | password > }}
user_name: ${{ secrets.<user_name> }}
registry_url: "https://jfrog-sfo.dolby.net/artifactory/dolbyio-capi-generic-sfo/<TARGET_FILE_PATH>"
artefacts_patterns: |
./build*/my-artefact-0.1.2-ubuntu20*.zip
./build*/my-artefact-*-ubuntu20-dbgsym.zip
action_shell: <bash | powershell> # required only for powershell - bash is set as default.
```
17 changes: 15 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion artefacts2jfrog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down

0 comments on commit a2e6788

Please sign in to comment.