WORKFLOW: added calculation for generating a vaild tag for automated PR builds [skip ci]

This commit is contained in:
XargonWan 2024-02-21 10:50:28 +01:00
parent d755f7ca30
commit 1efe0aa0d9

View file

@ -113,16 +113,27 @@ jobs:
# if it's a feature branch it will not marked as "latest" cooker version # if it's a feature branch it will not marked as "latest" cooker version
- name: "Set makeLatest (cooker only)" - name: "Set makeLatest (cooker only)"
run: | run: |
if [[ "$BRANCH_NAME" == 'feat/'* ]]; then if [[ "$BRANCH_NAME" == 'feat/'* || "$BRANCH_NAME" == 'ref/'* ]]; then
echo "MAKE_LATEST=false" >> $GITHUB_ENV echo "MAKE_LATEST=false" >> $GITHUB_ENV
else else
echo "MAKE_LATEST=true" >> $GITHUB_ENV echo "MAKE_LATEST=true" >> $GITHUB_ENV
fi fi
# if the branch is coming from a PR the tag should be manually built
- name: "Generate version tag"
run: |
if [[ "$BRANCH_NAME" == 'ref/'* ]]; then
pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}')
original_branch=$(git ls-remote --heads origin "refs/pull/$pr_number/head" | cut -d'/' -f3)
echo "TAG=PR-$pr_number-$original_branch-${{ env.buildid }}" >> $GITHUB_ENV
else
echo "TAG=${{env.BRANCH_NAME}}-${{ env.buildid }}" >> $GITHUB_ENV
fi
- name: Publish the flatpak in a new cooker release - name: Publish the flatpak in a new cooker release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
tag: "${{env.BRANCH_NAME}}-${{ env.buildid }}" tag: "${{env.TAG}}"
body: | body: |
# Release Notes (Cooker) # Release Notes (Cooker)
This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}. This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}.