Skip to content

Manual workflow to transfer images #1096

Manual workflow to transfer images

Manual workflow to transfer images #1096

name: Manual workflow to transfer images
on:
workflow_dispatch:
inputs:
USERNAME:
description: 'provide docker hub username'
required: true
default: ''
type: string
TOKEN:
description: 'provide docker hub token'
required: false
default: ''
type: string
DESTINATION_ORGANIZATION:
description: 'provide docker hub destination org'
required: true
default: ''
type: string
jobs:
chk_token:
runs-on: ubuntu-latest
outputs:
TOKEN: ${{ steps.ORG_TOKEN.outputs.TOKEN }}
USERNAME: ${{ steps.ORG_TOKEN.outputs.USERNAME }}
steps:
- name: Check if input TOKEN is empty
if: ${{ inputs.TOKEN == '' }}
id: ORG_TOKEN
run: |
if [[ ${{ inputs.DESTINATION_ORGANIZATION }} == mosipqa ]]; then
echo "TOKEN=QA_NAMESPACE_DOCKER_HUB" >> $GITHUB_OUTPUT
echo "USERNAME=DOCKER_USERNAME" >> $GITHUB_OUTPUT
fi
if [[ ${{ inputs.DESTINATION_ORGANIZATION }} == mosipint ]]; then
echo "TOKEN=INT_NAMESPACE_DOCKER_HUB" >> $GITHUB_OUTPUT
echo "USERNAME=DOCKER_USERNAME" >> $GITHUB_OUTPUT
fi
- name: Print Secret Name
run: |
echo "ORGANIZATION NAME : ${{ inputs.DESTINATION_ORGANIZATION }} "
echo "SECRET NAME : ${{ steps.ORG_TOKEN.outputs.TOKEN }}"
echo "USERNAME : ${{ steps.ORG_TOKEN.outputs.USERNAME }}"
Image-transfer:
needs: chk_token
uses: Rakshitha650/kattu/.github/workflows/image-transfer.yml@master
with:
DESTINATION_ORGANIZATION: ${{ inputs.DESTINATION_ORGANIZATION }}
secrets:
USERNAME: "${{ secrets[needs.chk_token.outputs.USERNAME] || inputs.USERNAME }}"
TOKEN: "${{ secrets[needs.chk_token.outputs.TOKEN] || inputs.TOKEN }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DEVOPS }}