WORKFLOW: fixing the source branch fetch [skip ci]

This commit is contained in:
XargonWan 2024-02-23 09:43:13 +01:00
parent 3ed0a02abe
commit da32df40a0

View file

@ -46,6 +46,33 @@ jobs:
- name: Generate cooker build ID - name: Generate cooker build ID
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh" run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh"
- name: Get branch name
id: branch_name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
# if it's a feature branch it will not marked as "latest" cooker version
- name: "Set makeLatest (cooker only)"
run: |
if [[ "$BRANCH_NAME" == 'feat/'* || "$BRANCH_NAME" == 'refs/'* ]]; 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" == 'refs/'* ]]; then
pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}')
source_branch=$(git show "refs/pull/$pr_number/merge" --no-patch --format="%P" | cut -d' ' -f2 | cut -d'/' -f3)
source_branch=${source_branch//\//-}
echo "[DEBUG] source branch is: $source_branch"
echo "TAG=PR-$pr_number-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
else
echo "TAG=${{env.BRANCH_NAME}}-${{ env.buildid }}" >> $GITHUB_ENV
fi
echo "Version TAG: ${{ env.TAG }}"
# backing up manifest in case download fails and hashes must be recalculated # backing up manifest in case download fails and hashes must be recalculated
- name: Manifest backup - name: Manifest backup
run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
@ -106,30 +133,6 @@ jobs:
id: commits id: commits
continue-on-error: true continue-on-error: true
- name: Get branch name
id: branch_name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
# if it's a feature branch it will not marked as "latest" cooker version
- name: "Set makeLatest (cooker only)"
run: |
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" == 'refs/'* ]]; 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: