name: 'Ping a Healthchecks.io server' description: 'Description de l action' author: 'Eric Coissac' inputs: image_name: description: 'name of the image' required: true image_tags: description: 'tags added to the image' required: true registry_server: description: 'Address of the image registry server' required: false default: "niepce.petite-maison-orange.fr" build_command: description: 'Command used to build the image (docker|podman)' required: false default: docker tag_command: description: 'Command used to tag the image (docker|podman)' required: false default: podman debug: description: 'Run the action in debug mode' required: false default: false type: boolean runs: using: 'composite' steps: - name: Set debug mode if: ${{ inputs.debug == true }} shell: bash run: | source "${{ github.action_path }}/bashlib.sh" export DEBUG="ON" echo "DEBUG=ON" >> $GITEA_ENV debug Debug switch on - name: Build the image shell: bash run: | source "${{ github.action_path }}/bashlib.sh" check_command ${{ inputs.build_command }} tags=(${{ inputs.image_tags }}) sep="" if [[ -n "${tags[0]}" ]] ; then sep=":" fi image=${{ inputs.registry_server }}/${{ inputs.image_name }}${sep}${tags[0]} ${{ inputs.build_command }} build -t ${image} . \ || error "Failed" "Cannot built the image ${{ inputs.image_name }}" \ && success "Image build" "${{ inputs.image_name }}" -name: tag images shell: bash run: | source "${{ github.action_path }}/bashlib.sh" tags=(${{ inputs.image_tags }}) check_command ${{ inputs.tag_command }} image=${{ inputs.registry_server }}/${{ inputs.image_name }}${sep}${tags[0]} if [[ "${{ inputs.build_command }}" != "${{ inputs.tag_command }}" ]] ; then ${{ inputs.build_command }} save ${image} -o $$.image.tar ${{ inputs.tag_command }} load -i $$.image.tar rm -f $$.image.tar fi for tag in "${tags[@]:1}" ; do ${{ inputs.tag_command }} tag ${image} \ ${{ inputs.registry_server }}/${{ inputs.image_name }}:${tag} \ || error "Failed" "tagging of image ${{ inputs.image_name }}:${tag}" \ && success "Image tagging" "${{ inputs.registry_server }}/${{ inputs.image_name }}:${tag}" done