on:
  push:
    tags:
      - "*"
  workflow_dispatch:
    inputs:
      tcl_source:
        description: 'Tcl/Tk source: tarball or github'
        type: choice
        options:
          - tarball
          - github
        default: 'tarball'
      tcl_ref:
        description: 'Tcl/Tk ref for github source (e.g. core-9-0-4); blank auto-resolves latest stable tag in series'
        type: string
        default: ''
      tcl_version_override:
        description: 'Tarball version override (e.g. 8.6.18 or 9.0.4); blank uses locked default'
        type: string
        default: ''
      appimagetool_release:
        description: 'AppImageTool release channel/tag (default: continuous)'
        type: string
        default: 'continuous'
      # NOTE: SBOM generation is experimental and not ready for production use
      generate_sbom:
        description: 'Generate SBOM (Software Bill of Materials) - experimental, not for production use'
        type: boolean
        default: false

name: CI-appimage9

env:
  APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage

jobs:
  build_appimage9:
    name: Build AppImage EL9
    runs-on: ubuntu-latest
    permissions:
      contents: write # action-gh-release
    steps:
      - name: Checkout code
        uses: actions/checkout@v7
        with:
          fetch-depth: 149 # enough to cover between tags
          fetch-tags: true # this should work see actions/checkout~issue#1471

      - name: Get the version
        id: get_version
        run: |
          git show -s
          version=$(cat VERSION) # 8.9.999
          version_tstamp=$(git show -s "--format=%cs" | tr -d '-') # YYYYMMDD
          version_hash=$(git show -s "--format=%h") # abcdefg
          version_num=$(ruby -e "print '$GITHUB_REF'.split('/')[2]") # legacy version method: master
          echo "version=${version}"
          echo "version_tstamp=${version_tstamp}"
          echo "version_hash=${version_hash}"
          echo "version_num=${version_num}"
          VERSION_NUM="${version}~${version_tstamp}~${version_hash}"
          echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV
          echo "MAGIC_APPIMAGE_OUTPUT_FILENAME=Magic-${VERSION_NUM}-x86_64-EL9.AppImage" >> $GITHUB_ENV
          # Is this GHA being run due to a push-on-tag ?  if so we make a GitHub release, otherwise we just publish artifact
          github_tag=$(echo -n "$GITHUB_REF" | sed -e 's#refs/tags/##') # 8.9.999
          echo "github_tag=$github_tag"
          if echo -n "$GITHUB_REF" | egrep -q "^refs/tags/" # check prefix
          then
            if [ -n "$github_tag" ]
            then
              echo "MY_GITHUB_TAG=${github_tag}" >> $GITHUB_ENV
            fi
          fi

      - name: Resolve AppImageTool download URL
        env:
          APPIMAGETOOL_RELEASE_INPUT: ${{ github.event.inputs.appimagetool_release || '' }}
        run: |
          appimagetool_release="${APPIMAGETOOL_RELEASE_INPUT:-continuous}"
          appimagetool_url="https://github.com/AppImage/appimagetool/releases/download/${appimagetool_release}/appimagetool-x86_64.AppImage"
          echo "APPIMAGETOOL_RELEASE=${appimagetool_release}" >> "$GITHUB_ENV"
          echo "APPIMAGETOOL_DOWNLOAD_URL=${appimagetool_url}" >> "$GITHUB_ENV"

      - name: Resolve TCL/TK source
        id: resolve_tcl
        env:
          DEFAULT_TCL_SOURCE: tarball
          TCL_LOCKED_VERSION: 9.0.4
          TCL_TAG_GLOB: core-9-0-*
          TCL_TAG_REGEX: '^core-9-0-[0-9]+$'
          TCL_REF_INPUT: ${{ github.event.inputs.tcl_ref || '' }}
          TCL_SOURCE_INPUT: ${{ github.event.inputs.tcl_source || '' }}
          TCL_VERSION_OVERRIDE: ${{ github.event.inputs.tcl_version_override || '' }}
        run: |
          set -euo pipefail

          known_sha() {
            case "$1/$2" in
              tcl/8.6.18) echo "8b9b554f3539b37bea20ee6cef14faa63df1259896e466328f596eca9f0c49a5" ;;
              tk/8.6.18)  echo "8c1d775126c39124c89752737c32c23636b3cd308d0445977aec58cfbc42c46c" ;;
              tcl/9.0.4)  echo "8c01bac92a9a8ce271b63d3aa28f09cde2c6762d6719ca671cdc8aee25391234" ;;
              tk/9.0.4)   echo "ab9bd89fcff2e1248b7a9c097035f817fa0725285028c95686fdb92db65bc148" ;;
              *)          echo "" ;;
            esac
          }

          retry_ls_remote() {
            local repo="$1"
            local refs="$2"
            local attempt
            for attempt in 1 2 3; do
              if git ls-remote --tags --refs "https://github.com/tcltk/${repo}.git" "$refs"; then
                return 0
              fi
              echo "Retry $attempt/3 failed for ${repo} ls-remote $refs" >&2
              sleep "$attempt"
            done
            return 1
          }

          resolve_latest_shared_tag() {
            local tcl_tags
            local tk_tags
            local shared_tags

            tcl_tags=$(retry_ls_remote tcl "refs/tags/${TCL_TAG_GLOB}" \
              | awk '{print $2}' \
              | sed 's#refs/tags/##' \
              | grep -E "${TCL_TAG_REGEX}" || true)
            tk_tags=$(retry_ls_remote tk "refs/tags/${TCL_TAG_GLOB}" \
              | awk '{print $2}' \
              | sed 's#refs/tags/##' \
              | grep -E "${TCL_TAG_REGEX}" || true)

            if [ -z "$tcl_tags" ] || [ -z "$tk_tags" ]; then
              return 1
            fi

            shared_tags=$(grep -Fx -f <(printf '%s\n' "$tcl_tags") <(printf '%s\n' "$tk_tags") || true)
            if [ -z "$shared_tags" ]; then
              return 1
            fi

            printf '%s\n' "$shared_tags" | sort -V | tail -1
          }

          tk_ref_exists() {
            local ref="$1"
            local attempt
            for attempt in 1 2 3; do
              if git ls-remote --tags --refs https://github.com/tcltk/tk.git "refs/tags/$ref" | grep -q .; then
                return 0
              fi
              echo "Retry $attempt/3 failed for tk ls-remote refs/tags/$ref" >&2
              sleep "$attempt"
            done
            return 1
          }

          source_method="${TCL_SOURCE_INPUT:-$DEFAULT_TCL_SOURCE}"
          tcl_version="${TCL_VERSION_OVERRIDE:-$TCL_LOCKED_VERSION}"
          tcl_ref="core-${tcl_version//./-}"
          tk_version="$tcl_version"
          tk_ref="$tcl_ref"

          if [ "$source_method" = "github" ]; then
            if [ -n "$TCL_REF_INPUT" ]; then
              tcl_ref="$TCL_REF_INPUT"
              tk_ref="$tcl_ref"
              echo "Using workflow_dispatch Tcl/Tk ref: $tcl_ref"
              if ! tk_ref_exists "$tk_ref"; then
                echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2
                exit 1
              fi
            else
              tcl_ref=$(resolve_latest_shared_tag || true)
              tk_ref="$tcl_ref"
              if [ -z "$tcl_ref" ]; then
                echo "No overlapping stable Tcl/Tk tags found for pattern ${TCL_TAG_GLOB}" >&2
                exit 1
              fi
              echo "Auto-resolved latest shared stable Tcl/Tk ref: $tcl_ref"
            fi

            if echo "$tcl_ref" | grep -Eq "$TCL_TAG_REGEX"; then
              tcl_version=$(echo "$tcl_ref" | sed -E 's/^core-([0-9]+)-([0-9]+)-([0-9]+)$/\1.\2.\3/')
              tk_version="$tcl_version"
            else
              echo "Warning: ref $tcl_ref does not match expected stable tag pattern; keeping Tcl/Tk version=$tcl_version"
            fi
          fi

          tcl_ref_tag="core-${tcl_version//./-}"
          tk_ref_tag="core-${tk_version//./-}"
          tcl_tarball_url="https://codeload.github.com/tcltk/tcl/tar.gz/refs/tags/$tcl_ref_tag"
          tk_tarball_url="https://codeload.github.com/tcltk/tk/tar.gz/refs/tags/$tk_ref_tag"

          tcl_sha=$(known_sha tcl "$tcl_version")
          tk_sha=$(known_sha tk "$tk_version")

          tcl_tarball_filename="tcl-${tcl_ref_tag}.tar.gz"
          tk_tarball_filename="tk-${tcl_ref_tag}.tar.gz"

          if [ -n "$tcl_sha" ]; then
            tcl_sha_display="$tcl_sha (SHA matches expected value)"
          else
            tcl_sha_display="expected SHA not known, please update workflow .yml"
          fi
          if [ -n "$tk_sha" ]; then
            tk_sha_display="$tk_sha (SHA matches expected value)"
          else
            tk_sha_display="expected SHA not known, please update workflow .yml"
          fi

          if [ "$source_method" = "github" ]; then
            tcl_tmpdir=$(mktemp -d)
            tk_tmpdir=$(mktemp -d)
            cleanup_tmpdirs() { rm -rf "$tcl_tmpdir" "$tk_tmpdir"; }
            trap cleanup_tmpdirs EXIT

            if ! git -c advice.detachedHead=false clone --depth 1 --single-branch --branch "$tcl_ref" https://github.com/tcltk/tcl.git "$tcl_tmpdir"; then
              echo "Failed to clone Tcl ref $tcl_ref" >&2
              exit 1
            fi
            if ! git -c advice.detachedHead=false clone --depth 1 --single-branch --branch "$tk_ref" https://github.com/tcltk/tk.git "$tk_tmpdir"; then
              echo "Failed to clone Tk ref $tk_ref" >&2
              exit 1
            fi

            tcl_commit=$(git -C "$tcl_tmpdir" rev-parse HEAD)
            tcl_commit_date=$(git -C "$tcl_tmpdir" log -1 --format=%ci)
            tk_commit=$(git -C "$tk_tmpdir" rev-parse HEAD)
            tk_commit_date=$(git -C "$tk_tmpdir" log -1 --format=%ci)

            cleanup_tmpdirs
            trap - EXIT
          else
            tcl_commit=""
            tcl_commit_date=""
            tk_commit=""
            tk_commit_date=""
          fi

          echo "TCL_SOURCE=$source_method" >> "$GITHUB_ENV"
          echo "TCL_VERSION=$tcl_version" >> "$GITHUB_ENV"
          echo "TK_VERSION=$tk_version" >> "$GITHUB_ENV"
          echo "TCL_REF=$tcl_ref" >> "$GITHUB_ENV"
          echo "TK_REF=$tk_ref" >> "$GITHUB_ENV"
          echo "TCL_TARBALL_URL=$tcl_tarball_url" >> "$GITHUB_ENV"
          echo "TK_TARBALL_URL=$tk_tarball_url" >> "$GITHUB_ENV"
          echo "TCL_TARBALL_FILENAME=$tcl_tarball_filename" >> "$GITHUB_ENV"
          echo "TK_TARBALL_FILENAME=$tk_tarball_filename" >> "$GITHUB_ENV"
          echo "TCL_TARBALL_SHA256=$tcl_sha" >> "$GITHUB_ENV"
          echo "TK_TARBALL_SHA256=$tk_sha" >> "$GITHUB_ENV"
          echo "TCL_COMMIT=$tcl_commit" >> "$GITHUB_ENV"
          echo "TCL_COMMIT_DATE=$tcl_commit_date" >> "$GITHUB_ENV"
          echo "TK_COMMIT=$tk_commit" >> "$GITHUB_ENV"
          echo "TK_COMMIT_DATE=$tk_commit_date" >> "$GITHUB_ENV"

          echo "## TCL/TK BUILD INFO" >> "$GITHUB_STEP_SUMMARY"
          echo "" >> "$GITHUB_STEP_SUMMARY"
          echo "| Field | Value |" >> "$GITHUB_STEP_SUMMARY"
          echo "| :-- | :-- |" >> "$GITHUB_STEP_SUMMARY"
          echo "| Source method | $source_method |" >> "$GITHUB_STEP_SUMMARY"
          echo "| Tcl version | $tcl_version |" >> "$GITHUB_STEP_SUMMARY"
          echo "| Tk version | $tk_version |" >> "$GITHUB_STEP_SUMMARY"
          if [ "$source_method" = "github" ]; then
            echo "| Tcl clone URL | https://github.com/tcltk/tcl.git |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tcl ref | $tcl_ref |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tcl commit | $tcl_commit |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tcl commit date | $tcl_commit_date |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk clone URL | https://github.com/tcltk/tk.git |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk ref | $tk_ref |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk commit | $tk_commit |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk commit date | $tk_commit_date |" >> "$GITHUB_STEP_SUMMARY"
          else
            echo "| Tcl tarball | $tcl_tarball_filename |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tcl tarball URL | $tcl_tarball_url |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tcl SHA256 | $tcl_sha_display |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk tarball | $tk_tarball_filename |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk tarball URL | $tk_tarball_url |" >> "$GITHUB_STEP_SUMMARY"
            echo "| Tk SHA256 | $tk_sha_display |" >> "$GITHUB_STEP_SUMMARY"
          fi
          echo "| AppImageTool release | ${APPIMAGETOOL_RELEASE} |" >> "$GITHUB_STEP_SUMMARY"
          echo "| AppImageTool URL | ${APPIMAGETOOL_DOWNLOAD_URL} |" >> "$GITHUB_STEP_SUMMARY"

      - name: Build project
        env:
          UPDATEINFORMATION: gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|Magic-*EL9.AppImage.zsync
        run: |
          cd appimage/9
          make \
            TCL_SOURCE="${TCL_SOURCE}" \
            TCL_VERSION="${TCL_VERSION}" \
            TCL_REF="${TCL_REF}" \
            TCL_TARBALL_URL="${TCL_TARBALL_URL}" \
            TK_TARBALL_URL="${TK_TARBALL_URL}" \
            TCL_TARBALL_SHA256="${TCL_TARBALL_SHA256}" \
            TK_TARBALL_SHA256="${TK_TARBALL_SHA256}" \
            UPDATEINFORMATION="${UPDATEINFORMATION}"

          ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
          ls -l *.AppImage
          sha256sum *.AppImage
          pwd

      - name: Validate AppImage
        run: |
          sudo apt-get install -y --no-install-recommends desktop-file-utils appstream
          cd appimage/9
          make validate

      - name: Create RELEASE-NOTES.txt
        run: |
          cd appimage/9
          # Find the last tag (that does not match the current GITHUB_REF)
          echo GITHUB_REF=$GITHUB_REF
          echo GITHUB_SHA=$GITHUB_SHA
          set +e
          git_show_ref=$(git show-ref --hash $GITHUB_REF) # get tagcommit hash
          git_show_ref_exitstatus=$?
          echo git_show_ref_exitstatus=$git_show_ref_exitstatus
          echo git_show_ref=$git_show_ref
          git_rev_list=$(git rev-list -n1 $GITHUB_REF) # get commit hash
          git_rev_list_exitstatus=$?
          echo git_rev_list_exitstatus=$git_rev_list_exitstatus
          echo git_rev_list=$git_rev_list
          set -e
          test "$git_show_ref" = "$GITHUB_SHA" || test "$git_rev_list" = "$GITHUB_SHA" # check we got the ref back (or fail CI)
          git_describe=$(git describe --tags $GITHUB_SHA | sed -e 's#\-\([0-9]\+\-g\)#\+\1#') # /-\d+-g/
          echo git_describe=$git_describe

          # RELEASE-NOTES-EL9.txt
          echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL9.txt
          echo "" >> RELEASE-NOTES-EL9.txt
          echo "This release is based on EL9 (AlmaLinux9), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL9.txt
          echo "" >> RELEASE-NOTES-EL9.txt
          echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-EL9.txt
          echo "" >> RELEASE-NOTES-EL9.txt
          length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
          sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
          echo "|   |   |" >> RELEASE-NOTES-EL9.txt
          echo "| :-------- | :------ |" >> RELEASE-NOTES-EL9.txt
          echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL9.txt
          echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL9.txt
          echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL9.txt
          echo "" >> RELEASE-NOTES-EL9.txt

          # RELEASE-NOTES-CL.txt
          set +e # allow this to fail to empty string
          git_previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
          echo git_previous_tag=$git_previous_tag
          set -e
          if [ -n "${git_previous_tag}" ]
          then
              echo "### Change Log (since previous tag):" > RELEASE-NOTES-CL.txt
              echo "\`\`\`" >> RELEASE-NOTES-CL.txt
              git log --oneline --no-color --no-decorate "refs/tags/${git_previous_tag}..${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
              echo "\`\`\`" >> RELEASE-NOTES-CL.txt
          else
              echo "### Change Log (last commit only):" > RELEASE-NOTES-CL.txt
              echo "\`\`\`" >> RELEASE-NOTES-CL.txt
              git log --oneline -n1 --no-color --no-decorate "${GITHUB_REF}" >> RELEASE-NOTES-CL.txt
              echo "\`\`\`" >> RELEASE-NOTES-CL.txt
          fi
          echo "" >> RELEASE-NOTES-CL.txt

          #echo "### Build Info:" > RELEASE-NOTES-BI.txt
          # FIXME extract package version info and DSO symvers into RELEASE-NOTES.txt
          #echo "" >> RELEASE-NOTES-BI.txt

          cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-EL9.txt
          cat RELEASE-NOTES-EL9.txt

          # RELEASE-NOTES-DOCS.txt
          echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/7/README.md" >> RELEASE-NOTES-DOCS.txt
          echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-DOCS.txt
          echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/9/README.md" >> RELEASE-NOTES-DOCS.txt
          echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/10/README.md" >> RELEASE-NOTES-DOCS.txt

          # RELEASE-NOTES-GH.txt (this is shared for all AppImage for one tag)
          echo "### commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-GH.txt
          if [[ "$GITHUB_REF" =~ ^refs/tags/ ]]
          then
            # show tag annotation with tags like before
            git tag  --cleanup=strip "--format=%(contents)" -n "${GITHUB_REF:10}" | sed -e 's#\([~|]\)#\\\1#g' >> RELEASE-NOTES-GH.txt
          fi
          echo "" >> RELEASE-NOTES-GH.txt
          cat RELEASE-NOTES-DOCS.txt >> RELEASE-NOTES-GH.txt
          cat RELEASE-NOTES-CL.txt >> RELEASE-NOTES-GH.txt

          echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
          echo "" >> $GITHUB_STEP_SUMMARY
          cat RELEASE-NOTES-EL9.txt >> $GITHUB_STEP_SUMMARY

      - name: Upload Release Asset
        if: ${{ env.MY_GITHUB_TAG != '' }} # if: ${{ github.ref_type == 'tag' }}
        uses: softprops/action-gh-release@v3
        with:
          body_path: ${{ github.workspace }}/appimage/9/RELEASE-NOTES-GH.txt
          files: |
            ${{ github.workspace }}/appimage/9/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
            ${{ github.workspace }}/appimage/9/RELEASE-NOTES-EL9.txt

      - name: Generate SBOM
        if: ${{ inputs.generate_sbom }}
        uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
        with:
          image: docker:magic_build
          format: spdx-json
          output-file: ${{ github.workspace }}/appimage/9/sbom-${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}.spdx.json
          upload-artifact: false
          upload-release-assets: false

      - name: Apply SBOM license metadata
        if: ${{ inputs.generate_sbom }}
        run: |
          cd appimage/9
          sbom_file="sbom-${MAGIC_APPIMAGE_OUTPUT_FILENAME}.spdx.json"
          jq '
            def is_tcltk:
              (.name | test("(^|/)(tclsh|wish)[0-9.]*$|(^|/)libtcl[^/]*\\.so(\\.[0-9.]+)*$|(^|/)libtk[^/]*\\.so(\\.[0-9.]+)*$"));
            def is_magic_linked:
              (.name | test("(^|/)(magicexec|magicdnull|tclmagic\\.so)$"));
            .packages |= map(
              if is_magic_linked then
                . + {
                  licenseConcluded: "HPND-UC-export-US AND TCL",
                  licenseDeclared: "HPND-UC-export-US AND TCL"
                }
              elif is_tcltk then
                . + {
                  licenseConcluded: "TCL",
                  licenseDeclared: "TCL"
                }
              else
                .
              end
            )
          ' "$sbom_file" > "$sbom_file.tmp"
          mv "$sbom_file.tmp" "$sbom_file"

      - name: Upload SBOM Release Asset
        if: ${{ env.MY_GITHUB_TAG != '' && inputs.generate_sbom }}
        uses: softprops/action-gh-release@v3
        with:
          files: |
            ${{ github.workspace }}/appimage/9/sbom-${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}.spdx.json

      - name: Upload SBOM Artifact
        if: ${{ inputs.generate_sbom }}
        uses: actions/upload-artifact@v7
        with:
          name: sbom-${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}.spdx.json
          path: |
            ${{ github.workspace }}/appimage/9/sbom-${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}.spdx.json

      - name: Upload Artifact
        #if: ${{ env.MY_GITHUB_TAG == '' }} # commented out to always upload
        uses: actions/upload-artifact@v7
        with:
          name: ${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
          path: |
            ${{ github.workspace }}/appimage/9/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
