moth

Monarch Of The Hill game server
git clone https://git.woozle.org/neale/moth.git

moth / build / ci
Neale Pickett  ·  2020-09-18

gitlab-vars

 1#! /bin/sh
 2
 3case $1 in
 4    -h|-help|--help)
 5        echo "Usage: $0 TARGET"
 6        echo
 7        echo "Sets CI build variables for gitlab"
 8        exit 1
 9        ;;
10esac
11
12branch=$(git symbolic-ref -q --short HEAD)
13if [ "$branch" = "main" ]; then
14    branch=latest
15fi
16
17printf "Branch: %s\n" "$branch"
18printf "::set-output name=branch::%s\n" "$branch"
19printf "::set-output name=tag::%s\n" "$branch"
20
21# I think it will use whichever comes last
22git tag --points-at HEAD | while read tag; do
23    printf "Tag: %s\n" "$tag"
24    printf "::set-output name=tag::%s\n" "$tag"
25done