Files
software-version/action.yaml

57 lines
1.4 KiB
YAML
Raw Normal View History

2025-04-14 13:47:46 +02:00
name: 'Ping a Healthchecks.io server'
description: 'Description de l action'
author: 'Eric Coissac'
inputs:
2025-04-14 13:59:09 +02:00
git_checkout:
description: 'Shall I checkout the git'
2025-04-14 13:47:46 +02:00
required: false
2025-04-14 13:59:09 +02:00
default: false
type: boolean
version_file:
description: 'Name of the file containing the version number'
2025-04-14 13:47:46 +02:00
required: false
2025-04-14 13:59:09 +02:00
default: 'software_version.txt'
2025-04-14 13:47:46 +02:00
debug:
description: 'Run the action in debug mode'
required: false
default: false
type: boolean
2025-04-14 13:59:09 +02:00
outputs:
version:
description: 'The version of the software packaged in the image'
2025-04-14 13:47:46 +02:00
runs:
using: 'composite'
steps:
- name: Load bash library
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/bash-library@main
- name: Set debug mode
2025-04-14 13:59:09 +02:00
if: ${{ inputs.debug == 'true' }}
2025-04-14 13:47:46 +02:00
shell: bash
run: |
source "${{ github.action_path }}/../bashlib.sh"
export DEBUG="ON"
echo "DEBUG=ON" >> $GITEA_ENV
debug Debug switch on
2025-04-14 13:59:09 +02:00
- name: Checkout code
if: ${{ inputs.git_checkout == 'true' }}
uses: actions/checkout@v4
2025-04-14 13:47:46 +02:00
2025-04-14 13:59:09 +02:00
- name: retrieve the version
run: |
# Lire le contenu du fichier et supprimer les espaces/retours chariots
SOFTVERSION=$(cat ${{ inputs.version_file }} \
| head -n 1 \
| tr -d ' \n' \
| sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//')
2025-04-14 13:47:46 +02:00
2025-04-14 13:59:09 +02:00
echo "::set-output name=version::${SOFTVERSION}"
2025-04-14 13:47:46 +02:00