diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml deleted file mode 100644 index 6eea0b71..00000000 --- a/.github/workflows/build_release.yml +++ /dev/null @@ -1,299 +0,0 @@ -name: "Build RetroDECK" - -on: - push: - branches: - - main - - cooker* - - feat* - - branch/cooker* - paths: - - '.github/workflows/**' - - 'automation_tools/**' - - 'config/**' - - 'functions/**' - - '*.sh' - - 'net.retrodeck.retrodeck.yml' - - 'net.retrodeck.retrodeck.appdata.xml' - pull_request: - branches: - - main - - cooker* - - workflow_dispatch: - -permissions: - contents: write - -jobs: - - # Build RetroDECK Job - Build_RetroDECK: - runs-on: retrodeck - outputs: - TAG: ${{ steps.version-tag.outputs.TAG }} - RELEASE_BODY: ${{ steps.version-tag.outputs.RELEASE_BODY }} - MAKE_LATEST: ${{ steps.version-tag.outputs.MAKE_LATEST }} - - steps: - # Remove Stuck Mounts - - name: Remove stuck mounts - run: | - 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/* - continue-on-error: true - - # Clone Repository - - name: Clone RetroDECK repo - uses: actions/checkout@v4 - with: - submodules: true - - # Install Dependencies - - name: Install dependencies - run: curl "https://raw.githubusercontent.com/RetroDECK/components-template/main/automation_tools/install_dependencies.sh" | bash - - # Generate Build ID for Cooker Branches - - name: Generate cooker build ID - if: github.ref != 'refs/heads/main' - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_build_id.sh" - - # Getting branch name, this needs as PR should be managed in a different way - - name: Get Branch Name - run: | - if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then - branch_name="$GITHUB_HEAD_REF" - else - branch_name="$GITHUB_REF_NAME" - fi - echo "Branch name: $branch_name" - echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV - - # 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)" - - # Ensure the manifest version was successfully extracted - if [[ -z "$MANIFEST_VERSION" ]]; then - echo "[ERROR] Failed to extract the manifest version." - exit 1 - fi - - # Determine the tag based on the GitHub event context - if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then - # Main branch tag - TAG="$MANIFEST_VERSION" - MAKE_LATEST=true - elif [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then - # Pull request tag, sanitize the source branch - source_branch="${GITHUB_HEAD_REF//\//-}" - TAG="PR-$source_branch-${{ github.run_id }}" - MAKE_LATEST=false - else - # Other branches (cooker branches) - TAG="$MANIFEST_VERSION-${{ env.BUILD_ID }}" - MAKE_LATEST=true - fi - - echo "TAG=$TAG" >> $GITHUB_ENV - echo "MAKE_LATEST=$MAKE_LATEST" >> $GITHUB_ENV - - echo "TAG=$TAG" >> $GITHUB_OUTPUT - echo "MAKE_LATEST=$MAKE_LATEST" >> $GITHUB_OUTPUT - - # backing up manifest in case download fails and hashes must be recalculated - - name: Manifest backup - run: "cp ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml ${GITHUB_WORKSPACE}/net.retrodeck.retrodeck.yml.bak" - - - name: Run pre-build automation tasks - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/pre_build_automation.sh" - - - name: "Adding flatpak portal for automated updates (Cooker only)" - if: github.ref != 'refs/heads/main' - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/cooker_flatpak_portal_add.sh" - - - name: "Updating release notes in appdata" - run: "automation_tools/appdata_management.sh" - - - name: "[DEBUG] Outputting manifest" - run: cat net.retrodeck.retrodeck.yml - - # Get Commits Since Last Published Release (Cooker only) - - name: Get commits since last published release - id: get-commits - if: github.ref != 'refs/heads/main' - run: | - # Get the latest published release tag - LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "") - - if [ -z "$LATEST_TAG" ]; then - echo "[INFO] No previous release found. Using all commits." - COMMITS=$(git log HEAD --pretty=format:"- %s") - else - echo "[INFO] Latest published release tag: $LATEST_TAG" - COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s") - fi - - # Debug: Print the commits list - echo "Commits since $LATEST_TAG:" - echo "$COMMITS" - - # Export the commits list to the GitHub environment - echo "COMMITS=$COMMITS" >> $GITHUB_ENV - - # - name: Extract XML Description - # uses: Mudlet/xmlstarlet-action@master - # id: extract-description - # with: - # args: sel -t -v "/component/releases/release[1]/description//text()" ./net.retrodeck.retrodeck.appdata.xml - - # Generate Release Body - - name: Generate release body text - id: generate-body - run: | - # Initialize the release body text - RELEASE_BODY="# Release Notes\n" - RELEASE_BODY+="This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}." - RELEASE_BODY+="On branch [${{env.BRANCH_NAME}}](https://repo.retrodeck.net/RetroDECK/RetroDECK/src/branch/${{env.BRANCH_NAME}})." - RELEASE_BODY+="## Commits since last release\n" - RELEASE_BODY+="$COMMITS\n\n" - - #raw_description="${{ steps.extract-description.outputs.result }}" - - # Convert
tags to markdown headers using sed - markdown_description=$(echo "$raw_description" | sed -e 's|
|\n### |g' -e 's|
||g') - - # Convert