2025-04-14 14:24:00 +02:00
|
|
|
name: 'Retreive the software version'
|
|
|
|
|
description: 'Retrieve the software version that will be packaged into the docker image'
|
2025-04-14 13:47:46 +02:00
|
|
|
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 14:11:16 +02:00
|
|
|
- name: Retrieve the version
|
|
|
|
|
shell: bash
|
2025-04-14 13:59:09 +02:00
|
|
|
run: |
|
2025-04-14 14:17:54 +02:00
|
|
|
# Lire le contenu du fichier et supprimer les espaces/retours chariots
|
|
|
|
|
SOFTVERSION=$(cat ${{ inputs.version_file }} \
|
2025-04-14 14:13:47 +02:00
|
|
|
| grep -v '^ *$' \
|
2025-04-14 13:59:09 +02:00
|
|
|
| head -n 1 \
|
2025-04-14 14:13:47 +02:00
|
|
|
| tr -d '\n' \
|
|
|
|
|
| sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//' \
|
|
|
|
|
| tr ' ' '-')
|
2025-04-14 13:47:46 +02:00
|
|
|
|
2025-04-14 14:17:54 +02:00
|
|
|
echo "version=${SOFTVERSION}" >> $GITHUB_OUTPUT
|
2025-04-14 13:47:46 +02:00
|
|
|
|
|
|
|
|
|