Skip to content

Commit 0069c94

Browse files
Harden release tooling with doctor, shellcheck, and artifact capture
1 parent 899d670 commit 0069c94

11 files changed

Lines changed: 240 additions & 25 deletions

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ jobs:
2121
with:
2222
node-version: '20'
2323

24+
- name: Install shellcheck
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y shellcheck
28+
29+
- name: Lint shell scripts
30+
run: |
31+
set -euo pipefail
32+
mapfile -d '' files < <(find . -type f \( -name "*.sh" -o -path "./.githooks/pre-push" \) -print0)
33+
for f in "${files[@]}"; do
34+
shellcheck "$f"
35+
done
36+
2437
- name: Lint JavaScript syntax
2538
run: |
2639
set -euo pipefail
@@ -69,3 +82,18 @@ jobs:
6982
npx playwright install --with-deps chromium firefox
7083
chmod +x scripts/browser_smoke.sh
7184
bash scripts/browser_smoke.sh
85+
86+
- name: Upload debug artifacts on failure
87+
if: failure()
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: ci-debug-${{ github.run_id }}-${{ github.job }}
91+
if-no-files-found: ignore
92+
path: |
93+
folderview.plus.plg
94+
folderview.plus.xml
95+
archive/*.txz
96+
archive/*.sha256
97+
CHANGELOG-fixes.md
98+
*.log
99+
scripts/*.log

.github/workflows/release-beta.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Release Beta
33
on:
44
workflow_dispatch:
55

6+
concurrency:
7+
group: folderview-plus-release
8+
cancel-in-progress: false
9+
610
jobs:
711
beta:
812
runs-on: ubuntu-latest
@@ -116,3 +120,18 @@ jobs:
116120
git commit -m "Build beta ${{ steps.beta.outputs.version }}"
117121
git push origin beta
118122
123+
- name: Upload debug artifacts on failure
124+
if: failure()
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: release-beta-debug-${{ github.run_id }}-${{ github.job }}
128+
if-no-files-found: ignore
129+
path: |
130+
folderview.plus.plg
131+
folderview.plus.xml
132+
archive/*.txz
133+
archive/*.sha256
134+
CHANGELOG-fixes.md
135+
*.log
136+
scripts/*.log
137+

.github/workflows/release-main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Release Main
33
on:
44
workflow_dispatch:
55

6+
concurrency:
7+
group: folderview-plus-release
8+
cancel-in-progress: false
9+
610
jobs:
711
release:
812
runs-on: ubuntu-latest
@@ -95,3 +99,19 @@ jobs:
9599
draft: false
96100
prerelease: false
97101

102+
- name: Upload debug artifacts on failure
103+
if: failure()
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: release-main-debug-${{ github.run_id }}-${{ github.job }}
107+
if-no-files-found: ignore
108+
path: |
109+
folderview.plus.plg
110+
folderview.plus.xml
111+
archive/*.txz
112+
archive/*.sha256
113+
CHANGELOG-fixes.md
114+
release_notes.md
115+
*.log
116+
scripts/*.log
117+

.github/workflows/release-on-main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
permissions:
1010
contents: write
1111

12+
concurrency:
13+
group: folderview-plus-release
14+
cancel-in-progress: false
15+
1216
jobs:
1317
release:
1418
runs-on: ubuntu-latest
@@ -136,3 +140,19 @@ jobs:
136140
gh release create "${TAG}" "${ARCHIVE}" "${CHECKSUM}" --title "${TAG}" --notes-file release_notes.md
137141
echo "Created release ${TAG}"
138142
fi
143+
144+
- name: Upload debug artifacts on failure
145+
if: failure()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: release-on-main-debug-${{ github.run_id }}-${{ github.job }}
149+
if-no-files-found: ignore
150+
path: |
151+
folderview.plus.plg
152+
folderview.plus.xml
153+
archive/*.txz
154+
archive/*.sha256
155+
release_notes.md
156+
CHANGELOG-fixes.md
157+
*.log
158+
scripts/*.log

.github/workflows/release-stable.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Release Stable
33
on:
44
workflow_dispatch:
55

6+
concurrency:
7+
group: folderview-plus-release
8+
cancel-in-progress: false
9+
610
jobs:
711
release:
812
runs-on: ubuntu-latest
@@ -126,3 +130,19 @@ jobs:
126130
draft: false
127131
prerelease: false
128132

133+
- name: Upload debug artifacts on failure
134+
if: failure()
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: release-stable-debug-${{ github.run_id }}-${{ github.job }}
138+
if-no-files-found: ignore
139+
path: |
140+
folderview.plus.plg
141+
folderview.plus.xml
142+
archive/*.txz
143+
archive/*.sha256
144+
CHANGELOG-fixes.md
145+
release_notes.md
146+
*.log
147+
scripts/*.log
148+

scripts/doctor.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
# shellcheck source=./lib.sh
6+
source "${ROOT_DIR}/scripts/lib.sh"
7+
8+
REQUIRED_COMMANDS=(
9+
bash
10+
tar
11+
sed
12+
awk
13+
grep
14+
find
15+
md5sum
16+
sha256sum
17+
php
18+
node
19+
git
20+
gh
21+
)
22+
23+
fvplus::require_commands "${REQUIRED_COMMANDS[@]}"
24+
25+
echo "Tooling doctor passed."
26+
for cmd in "${REQUIRED_COMMANDS[@]}"; do
27+
if "${cmd}" --version >/dev/null 2>&1; then
28+
version_line="$("${cmd}" --version 2>/dev/null | head -n 1)"
29+
echo " ${cmd}: ${version_line}"
30+
else
31+
echo " ${cmd}: installed"
32+
fi
33+
done
34+

scripts/ensure_plg_changes_entry.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ set -euo pipefail
33

44
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
55
PLG_FILE="${ROOT_DIR}/folderview.plus.plg"
6+
# shellcheck source=./lib.sh
7+
source "${ROOT_DIR}/scripts/lib.sh"
68

79
if [[ ! -f "${PLG_FILE}" ]]; then
8-
echo "ERROR: Missing plugin manifest: ${PLG_FILE}" >&2
9-
exit 1
10+
fvplus::fail "Missing plugin manifest: ${PLG_FILE}"
1011
fi
1112

12-
VERSION="$(sed -n 's/^<!ENTITY version "\([^"]*\)".*/\1/p' "${PLG_FILE}" | head -n 1 || true)"
13-
if [[ -z "${VERSION}" ]]; then
14-
echo "ERROR: Could not parse version from folderview.plus.plg" >&2
15-
exit 1
16-
fi
13+
VERSION="$(fvplus::read_plg_version "${PLG_FILE}")"
1714

1815
if grep -q "^###${VERSION}$" "${PLG_FILE}"; then
1916
echo "CHANGES entry already present for ${VERSION}"

scripts/install_smoke.sh

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,21 @@ set -euo pipefail
44
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
55
PLG_FILE="${ROOT_DIR}/folderview.plus.plg"
66
ARCHIVE_DIR="${FVPLUS_ARCHIVE_DIR:-${ROOT_DIR}/archive}"
7+
# shellcheck source=./lib.sh
8+
source "${ROOT_DIR}/scripts/lib.sh"
79

810
if [[ ! -f "${PLG_FILE}" ]]; then
9-
echo "ERROR: Missing plugin manifest: ${PLG_FILE}" >&2
10-
exit 1
11+
fvplus::fail "Missing plugin manifest: ${PLG_FILE}"
1112
fi
1213

13-
VERSION="$(sed -n 's/^<!ENTITY version "\([^"]*\)".*/\1/p' "${PLG_FILE}" | head -n 1 || true)"
14-
if [[ -z "${VERSION}" ]]; then
15-
echo "ERROR: Could not parse version from PLG manifest." >&2
16-
exit 1
17-
fi
14+
VERSION="$(fvplus::read_plg_version "${PLG_FILE}")"
1815

1916
ARCHIVE_FILE="${ARCHIVE_DIR}/folderview.plus-${VERSION}.txz"
2017
if [[ ! -f "${ARCHIVE_FILE}" ]]; then
21-
echo "ERROR: Missing archive for current version: ${ARCHIVE_FILE}" >&2
22-
exit 1
18+
fvplus::fail "Missing archive for current version: ${ARCHIVE_FILE}"
2319
fi
2420

25-
if ! command -v php >/dev/null 2>&1; then
26-
echo "ERROR: php is required for install smoke checks." >&2
27-
exit 1
28-
fi
29-
if ! command -v node >/dev/null 2>&1; then
30-
echo "ERROR: node is required for install smoke checks." >&2
31-
exit 1
32-
fi
21+
fvplus::require_commands php node tar sed grep find
3322

3423
ARCHIVE_LIST="$(tar -tf "${ARCHIVE_FILE}")"
3524
ARCHIVE_LIST_NORMALIZED="$(printf '%s\n' "${ARCHIVE_LIST}" | sed 's#^\./##')"

scripts/lib.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
fvplus::fail() {
4+
echo "ERROR: $*" >&2
5+
exit 1
6+
}
7+
8+
fvplus::require_commands() {
9+
local missing=()
10+
local cmd
11+
for cmd in "$@"; do
12+
if ! command -v "$cmd" >/dev/null 2>&1; then
13+
missing+=("$cmd")
14+
fi
15+
done
16+
if [[ ${#missing[@]} -gt 0 ]]; then
17+
fvplus::fail "Missing required commands: ${missing[*]}"
18+
fi
19+
}
20+
21+
fvplus::parse_plg_entity() {
22+
local entity_name="${1:-}"
23+
local plg_file="${2:-}"
24+
sed -n "s/^<!ENTITY ${entity_name} \"\\([^\"]*\\)\".*/\\1/p" "${plg_file}" | head -n 1 || true
25+
}
26+
27+
fvplus::read_plg_version() {
28+
local plg_file="${1:-}"
29+
local version=""
30+
version="$(fvplus::parse_plg_entity version "${plg_file}")"
31+
if [[ -z "${version}" ]]; then
32+
fvplus::fail "Could not parse version from ${plg_file}"
33+
fi
34+
echo "${version}"
35+
}
36+
37+
fvplus::archive_dir() {
38+
local root_dir="${1:-}"
39+
echo "${FVPLUS_ARCHIVE_DIR:-${root_dir}/archive}"
40+
}
41+
42+
fvplus::archive_file() {
43+
local root_dir="${1:-}"
44+
local version="${2:-}"
45+
local archive_dir=""
46+
archive_dir="$(fvplus::archive_dir "${root_dir}")"
47+
echo "${archive_dir}/folderview.plus-${version}.txz"
48+
}
49+

scripts/release_prepare.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
set -euo pipefail
33

44
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
# shellcheck source=./lib.sh
6+
source "${ROOT_DIR}/scripts/lib.sh"
57
cd "${ROOT_DIR}"
68

7-
chmod +x pkg_build.sh scripts/ensure_plg_changes_entry.sh scripts/release_guard.sh scripts/install_smoke.sh scripts/browser_smoke.sh
9+
fvplus::require_commands bash node
10+
chmod +x pkg_build.sh scripts/doctor.sh scripts/ensure_plg_changes_entry.sh scripts/release_guard.sh scripts/install_smoke.sh scripts/browser_smoke.sh
11+
bash scripts/doctor.sh
812

913
if [[ "${1:-}" == "--beta" ]]; then
1014
if [[ -n "${2:-}" ]]; then

0 commit comments

Comments
 (0)