Skip to content

fixes

fixes #16

Workflow file for this run

# SPDX-FileCopyrightText: 2023-2024 TII (SSRC) and the Ghaf contributors
#
# SPDX-License-Identifier: Apache-2.0
name: test
on:
workflow_dispatch:
push:
branches:
- test_versiontag
permissions:
contents: read
jobs:
build_target:
runs-on: ubuntu-latest
timeout-minutes: 360
name: Build FMO-OS
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: Generate build version
shell: bash
run: |
sha="${{ github.sha }}"
# Default to "git-<sha>"
buildver="git-${sha:0:7}"
if [[ "${{ github.ref_type }}" == "tag" ]]; then
buildver="${{ github.ref_name }}"
elif [[ "${{ github.ref_type }}" == "branch" ]]; then
# Check if there's a reachable tag on the branch
if git name-rev --name-only --tags --no-undefined "${{ github.ref }}" 2>/dev/null; then
buildver="$(git describe --tags "${{ github.ref }}")"
else
# No reachable parent tag on branch
buildver="git-${{ github.ref_name }}-${sha:0:7}"
fi
fi
echo "github.sha: ${{ github.sha }}"
echo "github.ref: ${{ github.ref }}"
echo "github.ref_type: ${{ github.ref_type }}"
echo "github.ref_name: ${{ github.ref_name }}"
echo "build_version=$buildver"
echo "build_version=$buildver" >> "$GITHUB_OUTPUT"