Skip to content

Commit

Permalink
Merge pull request #9 from bbc/jamessa-artifactory
Browse files Browse the repository at this point in the history
Fix artifactory upload
  • Loading branch information
j616 authored Nov 14, 2023
2 parents 2be6d5d + 26e0e41 commit 97304b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ jobs:
forceDocsUpload: ${{ inputs.forceDocsUpload == true }}
pythonVersion: ${{ inputs.pythonVersion || '3.10' }}
commontoolingBranch: ${{ inputs.commontoolingBranch || 'main' }}
enableArtifactoryPip: true
enableArtifactory: true
secrets: inherit
29 changes: 13 additions & 16 deletions .github/workflows/shared-ext-ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ on:
required: false
default: ''
type: string
enableArtifactoryPip:
description: 'Enable PIP access to artifactory'
enableArtifactory:
description: 'Upload to artifactory instead of PyPi'
required: false
default: false
type: boolean
enableUploadDocker:
description: 'Enable docker upload step. NOTE: Docker images will only be uploaded if the build is on a tag.'
required: false
default: false
type: boolean
secrets:
COMMONTOOLING_DEPLOY_KEY:
Expand Down Expand Up @@ -121,18 +122,6 @@ jobs:
- name: Create pip conf
run: touch ${{ github.workspace }}/.pip.conf

- name: ${{ format('{0}Configure Artifactory PIP registry', ((!inputs.enableArtifactoryPip) && 'NOT ENABLED | ' || '') ) }}
if: ${{ inputs.enableArtifactoryPip }}
run: |
touch ${{ github.workspace }}/.pip.conf
cat <<EOF >> ${{ github.workspace }}/.pip.conf
[global]
extra-index-url = https://${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_TOKEN }}@api.artifactory.labs.bbc/artifactory/api/pypi/ap-python/simple/
[search]
extra-index = https://${{ secrets.ARTIFACTORY_USERNAME }}:${{ secrets.ARTIFACTORY_TOKEN }}@api.artifactory.labs.bbc/artifactory/api/pypi/ap-python/
EOF
###############
## Run tests ##
###############
Expand Down Expand Up @@ -162,12 +151,20 @@ jobs:
#################################
## Upload deployable artefacts ##
#################################
- name: Upload wheels
if: ${{ startsWith(env.CHECKOUT_REF, 'refs/tags/') }}
- name: ${{ format('{0}Upload wheels to PyPi', ((inputs.enableArtifactory) && 'NOT ENABLED | ' || '') ) }}
if: ${{ (!inputs.enableArtifactory) && startsWith(env.CHECKOUT_REF, 'refs/tags/') }}
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10
with:
skip-existing: true

- name: ${{ format('{0}Upload wheels to Artifactory', ((!inputs.enableArtifactory) && 'NOT ENABLED | ' || '') ) }}
if: ${{ inputs.enableArtifactory && startsWith(env.CHECKOUT_REF, 'refs/tags/') }}
env:
TWINE_REPO: ${{ secrets.ARTIFACTORY_REPO }}
TWINE_REPO_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
TWINE_REPO_PASSWORD: ${{ secrets.ARTIFACTORY_TOKEN }}
run: make upload-wheels

- name: ${{ format('{0}Upload docker images', ((! inputs.enableUploadDocker) && 'NOT ENABLED | ' || '') ) }}
if: ${{ inputs.enableUploadDocker && startsWith(env.CHECKOUT_REF, 'refs/tags/') }}
run: make upload-docker
Expand Down

0 comments on commit 97304b2

Please sign in to comment.