WORKFLOW: integrating new versioning flow with tags and single cooker branch

This commit is contained in:
XargonWan 2024-07-17 21:18:19 +09:00
parent 3583afcd17
commit 018758d5b9
4 changed files with 27 additions and 5 deletions

View file

@ -64,6 +64,8 @@ jobs:
# if the branch is coming from a PR the tag should be manually built # if the branch is coming from a PR the tag should be manually built
- name: "Generate version tag" - name: "Generate version tag"
run: | run: |
source automation_tools/version_extractor.sh
manifest_version=$(fetch_manifest_version)
if [[ "$BRANCH_NAME" == 'refs/'* ]]; then if [[ "$BRANCH_NAME" == 'refs/'* ]]; then
pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}') pr_number=$(echo ${{env.BRANCH_NAME}} | awk -F'/' '{print $3}')
source_branch=$(curl -s "https://api.github.com/repos/XargonWan/RetroDECK/pulls/$pr_number" | jq -r '.head.ref') source_branch=$(curl -s "https://api.github.com/repos/XargonWan/RetroDECK/pulls/$pr_number" | jq -r '.head.ref')
@ -71,7 +73,7 @@ jobs:
echo "[DEBUG] source branch is: $source_branch" echo "[DEBUG] source branch is: $source_branch"
echo "TAG=PR-$pr_number-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV echo "TAG=PR-$pr_number-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
else else
echo "TAG=${{env.BRANCH_NAME}}-${{ env.buildid }}" >> $GITHUB_ENV echo "TAG=${{$manifest_version}}-${{ env.buildid }}" >> $GITHUB_ENV
fi fi
echo "Version TAG: ${{ env.TAG }}" echo "Version TAG: ${{ env.TAG }}"
@ -159,6 +161,16 @@ jobs:
repo: RetroDECK-cooker repo: RetroDECK-cooker
continue-on-error: true continue-on-error: true
- name: Rewrite Tag
run: |
git fetch --tags
if git rev-parse --verify "${{ env.TAG }}" >/dev/null 2>&1; then # if the tag exists
git tag -d "${{ env.TAG }}" # remove it from local repo
git push --delete origin "${{ env.TAG }}" # and from remote
fi
git tag "${{ env.TAG }}" # Create the tag locally
git push origin "${{ env.TAG }}" # Push the new tag in the remote repo
# In case it cannot publish the release at least it's providing the flatpak file for creating a manual release # In case it cannot publish the release at least it's providing the flatpak file for creating a manual release
- name: Upload RetroDECK-cooker.flatpak - name: Upload RetroDECK-cooker.flatpak
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -115,6 +115,16 @@ jobs:
repo: RetroDECK repo: RetroDECK
continue-on-error: true continue-on-error: true
- name: Rewrite Tag
run: |
git fetch --tags
if git rev-parse --verify "${{ env.REL_VER }}" >/dev/null 2>&1; then # if the tag exists
git tag -d "${{ env.REL_VER }}" # remove it from local repo
git push --delete origin "${{ env.REL_VER }}" # and from remote
fi
git tag "${{ env.REL_VER }}" # Create the tag locally
git push origin "${{ env.REL_VER }}" # Push the new tag in the remote repo
# In case it cannot publish the release at least it's providing the flatpak file for creating a manual release # In case it cannot publish the release at least it's providing the flatpak file for creating a manual release
- name: Upload RetroDECK.flatpak - name: Upload RetroDECK.flatpak
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View file

@ -42,8 +42,8 @@ appdata_version=$(fetch_appdata_version)
echo -e "Appdata:\t\t$appdata_version" echo -e "Appdata:\t\t$appdata_version"
# Additional checks # Additional checks
if [[ "$manifest_version" == "main" || "$manifest_version" == "THISBRANCH" ]]; then if [[ "$manifest_version" == "main" || "$manifest_version" == "THISBRANCH" || "$manifest_version" == *"cooker"* ]]; then
echo "Manifest version cannot be 'main' or 'THISBRANCH'. Please fix it." echo "Manifest version cannot be 'main', 'THISBRANCH', or contain 'cooker'. Please fix it."
exit 1 exit 1
fi fi

View file

@ -77,8 +77,8 @@ modules:
- | - |
# on main please update this with the version variable, eg: VERSION=0.8.0b # on main please update this with the version variable, eg: VERSION=0.8.0b
# on cooker will be THISBRANCH # on cooker will be VERSION=cooker-0.9.0b for example
VERSION=THISBRANCH VERSION=cooker-0.9.0b
git checkout ${GITHUB_REF_NAME} git checkout ${GITHUB_REF_NAME}
mkdir -p ${FLATPAK_DEST}/retrodeck/ mkdir -p ${FLATPAK_DEST}/retrodeck/