mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-16 19:35:39 +00:00
BUILD_RELEASE:
- re-enabled release body - optimized version tag generation - re-enabled build
This commit is contained in:
parent
e4ae1c311b
commit
6bec9e91c2
338
.github/workflows/build_release.yml
vendored
338
.github/workflows/build_release.yml
vendored
|
@ -29,218 +29,188 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# Build RetroDECK Job
|
# Build RetroDECK Job
|
||||||
# Build_RetroDECK:
|
Build_RetroDECK:
|
||||||
# runs-on: retrodeck-server
|
runs-on: retrodeck-server
|
||||||
# outputs:
|
outputs:
|
||||||
# tag: ${{ steps.set-outputs.outputs.tag }}
|
tag: ${{ steps.version-tag.outputs.tag }}
|
||||||
# release_body: ${{ steps.set-outputs.outputs.release_body }}
|
release_body: ${{ steps.version-tag.outputs.release_body }}
|
||||||
# env:
|
env:
|
||||||
# REKKU_TOKEN: ${{ needs.Generate-Rekku-Token.outputs.rekku_token }}
|
REKKU_TOKEN: ${{ needs.Generate-Rekku-Token.outputs.rekku_token }}
|
||||||
|
|
||||||
# steps:
|
steps:
|
||||||
# # Remove Stuck Mounts
|
# Remove Stuck Mounts
|
||||||
# - name: Remove stuck mounts
|
- name: Remove stuck mounts
|
||||||
# run: |
|
run: |
|
||||||
# sudo umount -f /home/ubuntu/actions-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
|
sudo umount -f /home/ubuntu/actions-runner/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
|
||||||
# sudo umount -f $HOME/actions-run/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
|
sudo umount -f $HOME/actions-run/_work/RetroDECK/RetroDECK/.flatpak-builder/rofiles/*
|
||||||
# continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
# # Clone Repository
|
# Clone Repository
|
||||||
# - name: Clone RetroDECK repo
|
- name: Clone RetroDECK repo
|
||||||
# uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
# with:
|
with:
|
||||||
# submodules: true
|
submodules: true
|
||||||
|
|
||||||
# # Install Dependencies
|
# Install Dependencies
|
||||||
# - name: Install dependencies
|
- name: Install dependencies
|
||||||
# run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash
|
run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash
|
||||||
|
|
||||||
# # Generate Build ID for Cooker Branches
|
# Generate Build ID for Cooker Branches
|
||||||
# - name: Generate cooker build ID
|
- name: Generate cooker build ID
|
||||||
# if: github.ref != 'refs/heads/main'
|
if: github.ref != 'refs/heads/main'
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh"
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh"
|
||||||
|
|
||||||
|
# Generates a version tag based on the event type (main branch, PR, or cooker) and sets it as output.
|
||||||
|
- name: Generate Version Tag
|
||||||
|
id: version-tag
|
||||||
|
run: |
|
||||||
|
# Source the version extractor script and fetch the manifest version
|
||||||
|
source automation_tools/version_extractor.sh
|
||||||
|
MANIFEST_VERSION="$(fetch_manifest_version)"
|
||||||
|
|
||||||
# # Get Branch Name
|
# Ensure the manifest version was successfully extracted
|
||||||
# - name: Get branch name
|
if [[ -z "$MANIFEST_VERSION" ]]; then
|
||||||
# id: get-branch-name
|
echo "[ERROR] Failed to extract the manifest version."
|
||||||
# run: |
|
exit 1
|
||||||
# branch_name=$(echo $GITHUB_REF | sed 's|refs/heads/||')
|
fi
|
||||||
# echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# # Generate Version Tag
|
# Determine the tag based on the GitHub event context
|
||||||
# - name: Generate version tag
|
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
|
||||||
# id: set-outputs
|
# Main branch tag
|
||||||
# run: |
|
TAG="$MANIFEST_VERSION"
|
||||||
# source automation_tools/version_extractor.sh
|
MAKE_LATEST=true
|
||||||
# MANIFEST_VERSION="$(fetch_manifest_version)"
|
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
|
||||||
# if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
|
# Pull request tag, sanitize the source branch
|
||||||
# TAG="$MANIFEST_VERSION"
|
source_branch="${GITHUB_HEAD_REF//\//-}"
|
||||||
# MAKE_LATEST=true
|
TAG="PR-$source_branch-${{ github.run_id }}"
|
||||||
# else
|
MAKE_LATEST=false
|
||||||
# source_branch="${GITHUB_HEAD_REF//\//-}"
|
else
|
||||||
# TAG="PR-$source_branch-${{ github.run_id }}"
|
# Other branches (cooker branches)
|
||||||
# MAKE_LATEST=false
|
TAG="$MANIFEST_VERSION-${{ env.BUILD_ID }}"
|
||||||
# fi
|
MAKE_LATEST=true
|
||||||
# echo "tag=$TAG" >> $GITHUB_OUTPUT
|
fi
|
||||||
# echo "MAKE_LATEST=$MAKE_LATEST" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# # if the branch is coming from a PR the tag should be manually built
|
# Export the tag and make_latest values
|
||||||
# - name: "Generate version tag and evaluating latest tag"
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||||
# run: |
|
echo "make_latest=$MAKE_LATEST" >> $GITHUB_OUTPUT
|
||||||
# # Source the version extractor script to get the manifest version
|
|
||||||
# source automation_tools/version_extractor.sh
|
|
||||||
# MANIFEST_VERSION="$(fetch_manifest_version)"
|
|
||||||
# echo "MANIFEST_VERSION=$MANIFEST_VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# # Check if the event is related to a pull request
|
# Debug output
|
||||||
# if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
|
echo "[INFO] MANIFEST_VERSION: $MANIFEST_VERSION"
|
||||||
# # Use GITHUB_HEAD_REF to get the source branch
|
echo "[INFO] Generated TAG: $TAG"
|
||||||
# source_branch="${GITHUB_HEAD_REF}"
|
echo "[INFO] MAKE_LATEST: $MAKE_LATEST"
|
||||||
|
|
||||||
# # Replace '/' with '-' in the branch name
|
# backing up manifest in case download fails and hashes must be recalculated
|
||||||
# source_branch=${source_branch//\//-}
|
- name: Manifest backup
|
||||||
# # Use GITHUB_HEAD_REF to get the source branch
|
run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
|
||||||
# source_branch="${GITHUB_HEAD_REF}"
|
|
||||||
|
|
||||||
# # Replace '/' with '-' in the branch name
|
- name: Run pre-build automation tasks
|
||||||
# source_branch=${source_branch//\//-}
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
|
||||||
# echo "[DEBUG] source branch is: $source_branch"
|
|
||||||
|
|
||||||
# # Generate the tag for a pull request
|
- name: "Adding flatpak portal for automated updates (Cooker only)"
|
||||||
# echo "TAG=PR-$source_branch-${{ env.buildid }}" >> $GITHUB_ENV
|
if: github.ref != 'refs/heads/main'
|
||||||
# echo "MAKE_LATEST=false" >> $GITHUB_OUTPUT # Not marked as the latest cooker version if it's a feature branch
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh"
|
||||||
# else
|
|
||||||
# # Generate the tag for non-pull request branches
|
|
||||||
# TAG="$MANIFEST_VERSION-${{ env.buildid }}"
|
|
||||||
# echo "TAG=$TAG" >> $GITHUB_ENV
|
|
||||||
# echo "MAKE_LATEST=true" >> $GITHUB_OUTPUT
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# # Output the manifest version and generated tag for debugging
|
- name: "Updating release notes in appdata"
|
||||||
# echo "MANIFEST_VERSION: $MANIFEST_VERSION"
|
run: "automation_tools/appdata_management.sh"
|
||||||
# echo "Version TAG: $TAG"
|
|
||||||
# echo "MAKE_LATEST: $MAKE_LATEST"
|
|
||||||
|
|
||||||
# # backing up manifest in case download fails and hashes must be recalculated
|
- name: "[DEBUG] Outputting manifest"
|
||||||
# - name: Manifest backup
|
run: cat net.retrodeck.retrodeck.yml
|
||||||
# run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak"
|
|
||||||
|
|
||||||
# - name: Run pre-build automation tasks
|
# Get Commits Since Last Release
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
|
- name: Get commits since last release
|
||||||
|
id: get-commits
|
||||||
|
run: |
|
||||||
|
LATEST_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1 --first-parent) || echo "")
|
||||||
|
if [ -z "$LATEST_TAG" ]; then
|
||||||
|
COMMITS=$(git log HEAD --pretty=format:"- %s")
|
||||||
|
else
|
||||||
|
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s")
|
||||||
|
fi
|
||||||
|
echo "commits=$COMMITS" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# - name: "Adding flatpak portal for automated updates (Cooker only)"
|
# Generate Release Body
|
||||||
# if: github.ref != 'refs/heads/main'
|
- name: Generate release body text
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh"
|
id: generate-body
|
||||||
|
run: |
|
||||||
|
# Initialize the release body
|
||||||
|
RELEASE_BODY="# Release Notes\n"
|
||||||
|
RELEASE_BODY+="This release is based on the commit: RetroDECK/RetroDECK@c8bd579ad4d0922ba7ab1f5c122cc782ff6adc66.\n"
|
||||||
|
RELEASE_BODY+="On branch [cooker](https://github.com/RetroDECK/RetroDECK/tree/cooker).\n\n"
|
||||||
|
RELEASE_BODY+="## Commits since last release\n"
|
||||||
|
RELEASE_BODY+="- RELEASE NOTES: fixed body\n\n"
|
||||||
|
|
||||||
# - name: "Updating release notes in appdata"
|
# Define the XML file path
|
||||||
# run: "automation_tools/appdata_management.sh"
|
xml_file="./net.retrodeck.retrodeck.appdata.xml"
|
||||||
|
|
||||||
# - name: "[DEBUG] Outputting manifest"
|
# Check if the XML file exists
|
||||||
# run: cat net.retrodeck.retrodeck.yml
|
if [[ ! -f "$xml_file" ]]; then
|
||||||
|
echo "Error: XML file not found: $xml_file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# # Get Commits Since Last Release
|
# Extract the raw description content using xmlstarlet
|
||||||
# - name: Get commits since last release
|
raw_description=$(xmlstarlet sel -t -m "/component/releases/release[1]/description/*" -c "." -n "$xml_file" 2>/dev/null)
|
||||||
# id: get-commits
|
|
||||||
# run: |
|
|
||||||
# LATEST_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1 --first-parent) || echo "")
|
|
||||||
# if [ -z "$LATEST_TAG" ]; then
|
|
||||||
# COMMITS=$(git log HEAD --pretty=format:"- %s")
|
|
||||||
# else
|
|
||||||
# COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s")
|
|
||||||
# fi
|
|
||||||
# echo "commits=$COMMITS" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# # Generate Release Body
|
# Check if xmlstarlet extraction was successful
|
||||||
# - name: Generate release body text
|
if [[ $? -ne 0 ]]; then
|
||||||
# id: generate-body
|
echo "Error: Failed to extract description content using xmlstarlet"
|
||||||
# run: |
|
exit 1
|
||||||
# # # Enable debugging
|
fi
|
||||||
# # set -x
|
|
||||||
|
|
||||||
# # # Initialize the release body
|
# Convert <p> tags to markdown headers using sed
|
||||||
# # RELEASE_BODY="# Release Notes\n"
|
markdown_description=$(echo "$raw_description" | sed -e 's|<p>|\n### |g' -e 's|</p>||g')
|
||||||
# # RELEASE_BODY+="This release is based on the commit: RetroDECK/RetroDECK@c8bd579ad4d0922ba7ab1f5c122cc782ff6adc66.\n"
|
|
||||||
# # RELEASE_BODY+="On branch [cooker](https://github.com/RetroDECK/RetroDECK/tree/cooker).\n\n"
|
|
||||||
# # RELEASE_BODY+="## Commits since last release\n"
|
|
||||||
# # RELEASE_BODY+="- RELEASE NOTES: fixed body\n\n"
|
|
||||||
|
|
||||||
# # # Define the XML file path
|
# Convert <li> tags to bullet points and trim spaces
|
||||||
# # xml_file="./net.retrodeck.retrodeck.appdata.xml"
|
markdown_description=$(echo "$markdown_description" | sed -e 's|<ul>||g' -e 's|</ul>||g' -e 's|<li>|- |g' -e 's|</li>||g' | awk '{$1=$1;print}')
|
||||||
|
|
||||||
# # # Check if the XML file exists
|
# Remove any remaining XML tags
|
||||||
# # if [[ ! -f "$xml_file" ]]; then
|
markdown_description=$(echo "$markdown_description" | sed -e 's/<[^>]*>//g')
|
||||||
# # echo "Error: XML file not found: $xml_file"
|
|
||||||
# # exit 1
|
|
||||||
# # fi
|
|
||||||
|
|
||||||
# # # Extract the raw description content
|
# Debug: Print the markdown description
|
||||||
# # raw_description=$(xmlstarlet sel -t -m "/component/releases/release[1]/description/*" -c "." -n "$xml_file" 2>/dev/null)
|
echo "Markdown Description:"
|
||||||
|
echo "$markdown_description"
|
||||||
|
|
||||||
# # # Check if xmlstarlet extraction was successful
|
# Append markdown content to the release body
|
||||||
# # if [[ $? -ne 0 ]]; then
|
RELEASE_BODY+="$markdown_description"
|
||||||
# # echo "Error: Failed to extract description content using xmlstarlet"
|
|
||||||
# # exit 1
|
|
||||||
# # fi
|
|
||||||
|
|
||||||
# # # Convert <p> tags to markdown headers using sed
|
# Set the release body as an output using heredoc to preserve newlines
|
||||||
# # markdown_description=$(echo "$raw_description" | sed -e 's|<p>|\n### |g' -e 's|</p>||g')
|
echo "release_body<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo -e "$RELEASE_BODY" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# # # Convert <li> tags to bullet points and trim spaces
|
- name: "Build flatpak: download only"
|
||||||
# # markdown_description=$(echo "$markdown_description" | sed -e 's|<ul>||g' -e 's|</ul>||g' -e 's|<li>|- |g' -e 's|</li>||g' | awk '{$1=$1;print}')
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
|
||||||
|
|
||||||
# # # Remove any remaining XML tags
|
# Sometimes flatpak download fails, in this case it tries a second time
|
||||||
# # markdown_description=$(echo "$markdown_description" | sed -e 's/<[^>]*>//g')
|
- name: "Build flatpak: download only (retry)"
|
||||||
|
if: steps.flatpak-download.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
echo "Download failed, maybe some hash changed since the build start."
|
||||||
|
echo "Recalculating hashes and retrying download..."
|
||||||
|
rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
|
||||||
|
cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
|
||||||
|
"${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
|
||||||
|
"${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
|
||||||
|
|
||||||
# # # Debug: Print the markdown description
|
- name: Build flatpak
|
||||||
# # echo "Markdown Description:"
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
|
||||||
# # echo "$markdown_description"
|
|
||||||
|
|
||||||
# # # Append markdown content with proper formatting
|
- name: Create Bundle
|
||||||
# # RELEASE_BODY+="$markdown_description\n"
|
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
|
||||||
|
|
||||||
# # # Output the release body for GitHub Actions
|
# Upload artifacts for other jobs
|
||||||
# # {
|
- name: Upload Build Artifacts
|
||||||
# # printf "release_body<<EOF\n%s\nEOF\n" "$RELEASE_BODY"
|
uses: actions/upload-artifact@v4
|
||||||
# # } >> "$GITHUB_OUTPUT"
|
with:
|
||||||
|
name: retrodeck-artifacts
|
||||||
# # # Disable debugging
|
path: |
|
||||||
# # set +x
|
RetroDECK*.flatpak
|
||||||
|
RetroDECK*.flatpak.sha
|
||||||
# RELEASE_BODY="# Release Notes\n"
|
RetroDECK*Artifact.tar.gz
|
||||||
|
|
||||||
# - name: "Build flatpak: download only"
|
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
|
|
||||||
|
|
||||||
# # Sometimes flatpak download fails, in this case it tries a second time
|
|
||||||
# - name: "Build flatpak: download only (retry)"
|
|
||||||
# if: steps.flatpak-download.outcome == 'failure'
|
|
||||||
# run: |
|
|
||||||
# echo "Download failed, maybe some hash changed since the build start."
|
|
||||||
# echo "Recalculating hashes and retrying download..."
|
|
||||||
# rm -f "{GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
|
|
||||||
# cp "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" "${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml"
|
|
||||||
# "${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh"
|
|
||||||
# "${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"
|
|
||||||
|
|
||||||
# - name: Build flatpak
|
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_only.sh"
|
|
||||||
|
|
||||||
# - name: Create Bundle
|
|
||||||
# run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_bundle.sh"
|
|
||||||
|
|
||||||
# # Upload artifacts for other jobs
|
|
||||||
# - name: Upload Build Artifacts
|
|
||||||
# uses: actions/upload-artifact@v4
|
|
||||||
# with:
|
|
||||||
# name: retrodeck-artifacts
|
|
||||||
# path: |
|
|
||||||
# RetroDECK*.flatpak
|
|
||||||
# RetroDECK*.flatpak.sha
|
|
||||||
# RetroDECK*Artifact.tar.gz
|
|
||||||
|
|
||||||
GitHub-publish:
|
GitHub-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: [Generate-Rekku-Token, Build_RetroDECK]
|
needs: Build_RetroDECK
|
||||||
env:
|
env:
|
||||||
tag: ${{ needs.Build_RetroDECK.outputs.tag }}
|
tag: ${{ needs.Build_RetroDECK.outputs.tag }}
|
||||||
release_body: ${{ needs.Build_RetroDECK.outputs.release_body }}
|
release_body: ${{ needs.Build_RetroDECK.outputs.release_body }}
|
||||||
|
@ -287,12 +257,12 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git submodule deinit -f --all
|
git submodule deinit -f --all
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
if git rev-parse --verify "${{ steps.set-outputs.outputs.tag }}" >/dev/null 2>&1; then
|
if git rev-parse --verify "${{ steps.version-tag.outputs.tag }}" >/dev/null 2>&1; then
|
||||||
git tag -d "${{ steps.set-outputs.outputs.tag }}"
|
git tag -d "${{ steps.version-tag.outputs.tag }}"
|
||||||
git push --delete origin "${{ steps.set-outputs.outputs.tag }}"
|
git push --delete origin "${{ steps.version-tag.outputs.tag }}"
|
||||||
fi
|
fi
|
||||||
git tag "${{ steps.set-outputs.outputs.tag }}"
|
git tag "${{ steps.version-tag.outputs.tag }}"
|
||||||
git push origin "${{ steps.set-outputs.outputs.tag }}"
|
git push origin "${{ steps.version-tag.outputs.tag }}"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ steps.generate-rekku-token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.generate-rekku-token.outputs.token }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue