.github/.github/workflows/standard-versioning-for-doc...

28 lines
897 B
YAML

name: Standard Docker Container Versioning
on:
workflow_call:
outputs:
tags:
description: "tags of the docker image"
value: ${{ jobs.set_env.outputs.tags }}
jobs:
set_env:
name: Create version tag
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.version_step.outputs.tags }}
steps:
- id: version_step
run: |
if [ "${{ github.ref_name }}" != "" ] && [ "${{ github.ref_name }}" != "main" ]; then
echo "tags=${{ github.ref_name }},${{ github.sha }}" >> $GITHUB_OUTPUT
fi
if [ "${{ github.ref_name }}" = "main" ]; then
echo "tags=latest,${{ github.sha }}" >> $GITHUB_OUTPUT
fi
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "tags=${{ github.event.pull_request.head.ref }},${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
fi