From 1efe0aa0d9d504da4d56d238d28ee65bf51faf08 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 21 Feb 2024 10:50:28 +0100 Subject: [PATCH] WORKFLOW: added calculation for generating a vaild tag for automated PR builds [skip ci] --- .../workflows/cooker-selfhosted-persistent.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cooker-selfhosted-persistent.yml b/.github/workflows/cooker-selfhosted-persistent.yml index dced323f..b2403330 100644 --- a/.github/workflows/cooker-selfhosted-persistent.yml +++ b/.github/workflows/cooker-selfhosted-persistent.yml @@ -113,16 +113,27 @@ jobs: # if it's a feature branch it will not marked as "latest" cooker version - name: "Set makeLatest (cooker only)" run: | - if [[ "$BRANCH_NAME" == 'feat/'* ]]; then + if [[ "$BRANCH_NAME" == 'feat/'* || "$BRANCH_NAME" == 'ref/'* ]]; then echo "MAKE_LATEST=false" >> $GITHUB_ENV else echo "MAKE_LATEST=true" >> $GITHUB_ENV 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 uses: ncipollo/release-action@v1 with: - tag: "${{env.BRANCH_NAME}}-${{ env.buildid }}" + tag: "${{env.TAG}}" body: | # Release Notes (Cooker) This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}.