40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Prepare Build
|
|
run-name: Prepare Build Version
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: [ runner ]
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
|
steps:
|
|
- name: Clone Repository
|
|
uses: https://github.com/actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
- name: Get Date and Build Number
|
|
run: |
|
|
git fetch --tags
|
|
git tag
|
|
DATE=$(date +'%Y.%m.%d')
|
|
TAG_COUNT=$(git tag -l "${DATE}.*" | wc -l)
|
|
BUILD_NUMBER=$(($TAG_COUNT + 1))
|
|
BUILD_VERSION="${DATE}.${BUILD_NUMBER}.dev1"
|
|
echo "$BUILD_VERSION" > version.txt
|
|
echo "VERSION $BUILD_VERSION"
|
|
|
|
- name: Create Git Tag for Build
|
|
run: |
|
|
git config user.name "ci"
|
|
git config user.email "dev@sh-edraft.de"
|
|
echo "tag $(cat version.txt)"
|
|
git tag $(cat version.txt)
|
|
git push origin --tags
|
|
|
|
- name: Upload build version artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: version
|
|
path: version.txt |