319 lines
14 KiB
YAML
319 lines
14 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
tcl_source:
|
|
description: 'Tcl/Tk source: tarball or github'
|
|
type: choice
|
|
options:
|
|
- tarball
|
|
- github
|
|
default: 'github'
|
|
tcl_ref:
|
|
description: 'Tcl/Tk ref for github source (e.g. core-8-6-18); 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: ''
|
|
|
|
name: CI-appimage8
|
|
|
|
env:
|
|
APPIMAGETOOL_DOWNLOAD_URL: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
|
|
jobs:
|
|
build_appimage8:
|
|
name: Build AppImage EL8
|
|
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-EL8.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 TCL/TK source
|
|
id: resolve_tcl
|
|
env:
|
|
DEFAULT_TCL_SOURCE: github
|
|
TCL_LOCKED_VERSION: 8.6.18
|
|
TCL_TAG_GLOB: core-8-6-*
|
|
TCL_TAG_REGEX: '^core-8-6-[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 refs="$1"
|
|
local attempt
|
|
for attempt in 1 2 3; do
|
|
if git ls-remote --tags --refs https://github.com/tcltk/tcl.git "$refs"; then
|
|
return 0
|
|
fi
|
|
echo "Retry $attempt/3 failed for tcl ls-remote $refs" >&2
|
|
sleep "$attempt"
|
|
done
|
|
return 1
|
|
}
|
|
|
|
tk_tag_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//./-}"
|
|
|
|
if [ "$source_method" = "github" ]; then
|
|
if [ -n "$TCL_REF_INPUT" ]; then
|
|
tcl_ref="$TCL_REF_INPUT"
|
|
echo "Using workflow_dispatch TCL ref: $tcl_ref"
|
|
else
|
|
tcl_ref=$(retry_ls_remote "refs/tags/${TCL_TAG_GLOB}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -1)
|
|
test -n "$tcl_ref"
|
|
echo "Auto-resolved latest Tcl ref: $tcl_ref"
|
|
fi
|
|
|
|
if ! tk_tag_exists "$tcl_ref"; then
|
|
echo "Missing matching Tk tag for Tcl ref: $tcl_ref" >&2
|
|
exit 1
|
|
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/')
|
|
else
|
|
echo "Warning: ref $tcl_ref does not match expected stable tag pattern; keeping Tcl version=$tcl_version"
|
|
fi
|
|
fi
|
|
|
|
tcl_ref_tag="core-${tcl_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/$tcl_ref_tag"
|
|
|
|
tcl_sha=$(known_sha tcl "$tcl_version")
|
|
tk_sha=$(known_sha tk "$tcl_version")
|
|
|
|
if [ -n "$tcl_sha" ] && [ -n "$tk_sha" ]; then
|
|
sha_status="verified against known SHA"
|
|
else
|
|
sha_status="best-effort — no known SHA (actual SHA is printed during Docker build)"
|
|
fi
|
|
|
|
if [ "$source_method" = "github" ]; then
|
|
tcl_tmpdir=$(mktemp -d)
|
|
git -c advice.detachedHead=false clone --depth 1 --single-branch --branch "$tcl_ref" https://github.com/tcltk/tcl.git "$tcl_tmpdir"
|
|
tcl_commit=$(git -C "$tcl_tmpdir" rev-parse HEAD)
|
|
tcl_commit_date=$(git -C "$tcl_tmpdir" log -1 --format=%ci)
|
|
rm -rf "$tcl_tmpdir"
|
|
else
|
|
tcl_commit=""
|
|
tcl_commit_date=""
|
|
fi
|
|
|
|
echo "TCL_SOURCE=$source_method" >> "$GITHUB_ENV"
|
|
echo "TCL_VERSION=$tcl_version" >> "$GITHUB_ENV"
|
|
echo "TCL_REF=$tcl_ref" >> "$GITHUB_ENV"
|
|
echo "TCL_TARBALL_URL=$tcl_tarball_url" >> "$GITHUB_ENV"
|
|
echo "TK_TARBALL_URL=$tk_tarball_url" >> "$GITHUB_ENV"
|
|
echo "TCL_TARBALL_SHA256=$tcl_sha" >> "$GITHUB_ENV"
|
|
echo "TK_TARBALL_SHA256=$tk_sha" >> "$GITHUB_ENV"
|
|
echo "TCL_SHA_STATUS=$sha_status" >> "$GITHUB_ENV"
|
|
echo "TCL_COMMIT=$tcl_commit" >> "$GITHUB_ENV"
|
|
echo "TCL_COMMIT_DATE=$tcl_commit_date" >> "$GITHUB_ENV"
|
|
|
|
echo "## Tcl/Tk source" >> "$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/Tk version | $tcl_version |" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "| Tcl ref | $tcl_ref |" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "| SHA status | $sha_status |" >> "$GITHUB_STEP_SUMMARY"
|
|
if [ -n "$tcl_commit" ]; then
|
|
echo "| Tcl commit | $tcl_commit |" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "| Tcl commit date | $tcl_commit_date |" >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
- name: Build project
|
|
run: |
|
|
cd appimage/8
|
|
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}"
|
|
|
|
ln -v Magic-x86_64.AppImage "${MAGIC_APPIMAGE_OUTPUT_FILENAME}"
|
|
ls -l *.AppImage
|
|
sha256sum *.AppImage
|
|
pwd
|
|
|
|
- name: Create RELEASE-NOTES.txt
|
|
run: |
|
|
cd appimage/8
|
|
# 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-EL8.txt
|
|
echo "### ${MAGIC_APPIMAGE_OUTPUT_FILENAME} commit ${git_describe}" | sed -e 's#~#\\~#g' > RELEASE-NOTES-EL8.txt
|
|
echo "" >> RELEASE-NOTES-EL8.txt
|
|
echo "This release is based on EL8 (AlmaLinux8), the AppImage format is designed to run on a wide range of Linux distributions." >> RELEASE-NOTES-EL8.txt
|
|
echo "" >> RELEASE-NOTES-EL8.txt
|
|
echo "See documentation at https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA:0:8}/appimage/8/README.md" >> RELEASE-NOTES-EL8.txt
|
|
echo "" >> RELEASE-NOTES-EL8.txt
|
|
length_info=$(stat "--format=%s bytes" "${MAGIC_APPIMAGE_OUTPUT_FILENAME}")
|
|
sha256_info=$(sha256sum "${MAGIC_APPIMAGE_OUTPUT_FILENAME}" | cut -d ' ' -f1)
|
|
echo "| | |" >> RELEASE-NOTES-EL8.txt
|
|
echo "| :-------- | :------ |" >> RELEASE-NOTES-EL8.txt
|
|
echo "| File Name | ${MAGIC_APPIMAGE_OUTPUT_FILENAME} |" | sed -e 's#~#\\~#g' >> RELEASE-NOTES-EL8.txt
|
|
echo "| File Length | ${length_info} |" >> RELEASE-NOTES-EL8.txt
|
|
echo "| File SHA256 | ${sha256_info} |" >> RELEASE-NOTES-EL8.txt
|
|
echo "" >> RELEASE-NOTES-EL8.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-EL8.txt
|
|
cat RELEASE-NOTES-EL8.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
|
|
|
|
# Show in action/artifact output
|
|
echo "## TCL/TK BUILD INFO" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Source: ${TCL_SOURCE}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Version: ${TCL_VERSION}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Ref: ${TCL_REF}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- SHA status: ${TCL_SHA_STATUS}" >> $GITHUB_STEP_SUMMARY
|
|
if [ -n "${TCL_COMMIT}" ]; then
|
|
echo "- TCL commit: ${TCL_COMMIT}" >> $GITHUB_STEP_SUMMARY
|
|
echo "- TCL commit date: ${TCL_COMMIT_DATE}" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
echo "## RELEASE NOTES" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
cat RELEASE-NOTES-EL8.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/8/RELEASE-NOTES-GH.txt
|
|
files: |
|
|
${{ github.workspace }}/appimage/8/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|
|
${{ github.workspace }}/appimage/8/RELEASE-NOTES-EL8.txt
|
|
|
|
- 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/8/${{env.MAGIC_APPIMAGE_OUTPUT_FILENAME}}
|