feat/release-page #2
1 changed files with 33 additions and 20 deletions
fix state file: use JSON instead of shell-sourcable env
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 5m16s
Some checks failed
Forgejo Release postit-deb / release (push) Failing after 5m16s
The previous version wrote RELEASE_BODY to a state file using the
'<<EOF ... EOF' heredoc syntax, then 'source'd that file at the
top of each subsequent step. Bash cannot parse that file as
shell input: the heredoc body contains markdown with backticks,
asterisks, colons, etc., which bash tries to interpret as
commands ('postit: command not found', '1.0.6: command not
found', etc.).
Switch to JSON via jq: jq handles all escaping correctly via
--arg/--argjson. Each step reads the fields it needs with
`jq -r '.field' $STATE_FILE`.
Also fixes a botched jq merge in the validation step that
mixed `jq -n ... > STATE_FILE` with a `<<< "" `
here-string to the same file.
commit
ba8ffe5f5b
|
|
@ -29,10 +29,12 @@
|
||||||
# on met à jour la release existante plutôt que d'en multiplier
|
# on met à jour la release existante plutôt que d'en multiplier
|
||||||
# pour un même tag. Le permalien /releases/tag/<tag> reste stable.
|
# pour un même tag. Le permalien /releases/tag/<tag> reste stable.
|
||||||
#
|
#
|
||||||
# Inter-step state: we persist values between steps via a plain
|
# Inter-step state: persisted as JSON in /tmp/release-state.json,
|
||||||
# env file under /tmp, sourced at the top of each step that needs
|
# read at the top of each step with `jq -r .<field>`. Using JSON
|
||||||
# it. This keeps the workflow self-contained and avoids any
|
# sidesteps shell parsing issues that come with sourcing a file
|
||||||
# runtime variable names we did not choose.
|
# that contains heredocs / markdown / colons / etc. — RELEASE_BODY
|
||||||
|
# in particular is markdown content straight from CHANGELOG.md and
|
||||||
|
# cannot be safely `source`d.
|
||||||
name: Forgejo Release postit-deb
|
name: Forgejo Release postit-deb
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
@ -63,7 +65,7 @@ jobs:
|
||||||
container:
|
container:
|
||||||
image: docker.io/pazof/yavsc-build-env:debian12-dotnet10-android36-v2
|
image: docker.io/pazof/yavsc-build-env:debian12-dotnet10-android36-v2
|
||||||
env:
|
env:
|
||||||
STATE_FILE: /tmp/release-state.env
|
STATE_FILE: /tmp/release-state.json
|
||||||
steps:
|
steps:
|
||||||
- name: Installer les pré-requis de build (debhelper + icônes)
|
- name: Installer les pré-requis de build (debhelper + icônes)
|
||||||
# L'image runner fournit déjà dotnet-sdk-10.0, git, jq,
|
# L'image runner fournit déjà dotnet-sdk-10.0, git, jq,
|
||||||
|
|
@ -100,11 +102,14 @@ jobs:
|
||||||
git checkout "$TAG"
|
git checkout "$TAG"
|
||||||
|
|
||||||
echo "Checked out at $(git rev-parse HEAD) on tag $TAG"
|
echo "Checked out at $(git rev-parse HEAD) on tag $TAG"
|
||||||
echo "TAG=$TAG" >> "$STATE_FILE"
|
|
||||||
|
# Persist TAG in the state file. --arg ensures proper
|
||||||
|
# JSON escaping of any special chars.
|
||||||
|
jq -n --arg tag "$TAG" '{tag: $tag}' > "$STATE_FILE"
|
||||||
|
|
||||||
- name: Valider le tag et la section CHANGELOG
|
- name: Valider le tag et la section CHANGELOG
|
||||||
run: |
|
run: |
|
||||||
source "$STATE_FILE"
|
TAG=$(jq -r '.tag' "$STATE_FILE")
|
||||||
cd /src/_src
|
cd /src/_src
|
||||||
echo "Validating tag $TAG"
|
echo "Validating tag $TAG"
|
||||||
|
|
||||||
|
|
@ -176,19 +181,21 @@ jobs:
|
||||||
|
|
||||||
echo "Section CHANGELOG validée pour [$TAG] - $CHANNEL"
|
echo "Section CHANGELOG validée pour [$TAG] - $CHANNEL"
|
||||||
|
|
||||||
# Persist values for the next steps via our local state file.
|
# Persist validation results. Use --arg for strings (so
|
||||||
{
|
# jq handles escaping of backticks, asterisks, colons,
|
||||||
echo "RELEASE_BODY<<EOF"
|
# etc.) and --argjson for booleans.
|
||||||
echo "$RELEASE_BODY"
|
jq -n \
|
||||||
echo "EOF"
|
--arg tag "$TAG" \
|
||||||
echo "IS_PRERELEASE=$IS_PRERELEASE"
|
--arg body "$RELEASE_BODY" \
|
||||||
} >> "$STATE_FILE"
|
--argjson is_prerelease "$IS_PRERELEASE" \
|
||||||
|
'{tag: $tag, body: $body, is_prerelease: $is_prerelease}' \
|
||||||
|
> "$STATE_FILE"
|
||||||
|
|
||||||
- name: Build .deb amd64
|
- name: Build .deb amd64
|
||||||
env:
|
env:
|
||||||
POSTIT_RUNTIME: linux-x64
|
POSTIT_RUNTIME: linux-x64
|
||||||
run: |
|
run: |
|
||||||
source "$STATE_FILE"
|
TAG=$(jq -r '.tag' "$STATE_FILE")
|
||||||
cd /src/_src
|
cd /src/_src
|
||||||
echo "→ Building amd64 for POSTIT_GIT_TAG=$TAG"
|
echo "→ Building amd64 for POSTIT_GIT_TAG=$TAG"
|
||||||
make deb POSTIT_GIT_TAG="$TAG" POSTIT_RUNTIME=linux-x64
|
make deb POSTIT_GIT_TAG="$TAG" POSTIT_RUNTIME=linux-x64
|
||||||
|
|
@ -197,7 +204,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
POSTIT_RUNTIME: linux-arm64
|
POSTIT_RUNTIME: linux-arm64
|
||||||
run: |
|
run: |
|
||||||
source "$STATE_FILE"
|
TAG=$(jq -r '.tag' "$STATE_FILE")
|
||||||
cd /src/_src
|
cd /src/_src
|
||||||
echo "→ Building arm64 for POSTIT_GIT_TAG=$TAG"
|
echo "→ Building arm64 for POSTIT_GIT_TAG=$TAG"
|
||||||
# Cross-RID .NET depuis un hôte amd64 : standard, pas
|
# Cross-RID .NET depuis un hôte amd64 : standard, pas
|
||||||
|
|
@ -206,7 +213,7 @@ jobs:
|
||||||
|
|
||||||
- name: Localiser les .deb produits
|
- name: Localiser les .deb produits
|
||||||
run: |
|
run: |
|
||||||
source "$STATE_FILE"
|
TAG=$(jq -r '.tag' "$STATE_FILE")
|
||||||
cd /src
|
cd /src
|
||||||
DEB_AMD64=$(find . -maxdepth 3 -name "postit_*${TAG}-1_amd64.deb" \
|
DEB_AMD64=$(find . -maxdepth 3 -name "postit_*${TAG}-1_amd64.deb" \
|
||||||
-not -path "./_src/debian/*" -printf '%p\n' | head -1)
|
-not -path "./_src/debian/*" -printf '%p\n' | head -1)
|
||||||
|
|
@ -217,8 +224,10 @@ jobs:
|
||||||
ls -la /src/ 2>/dev/null || true
|
ls -la /src/ 2>/dev/null || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "DEB_AMD64=/src/$DEB_AMD64" >> "$STATE_FILE"
|
# Merge .deb paths into state file.
|
||||||
echo "DEB_ARM64=/src/$DEB_ARM64" >> "$STATE_FILE"
|
jq --arg amd64 "/src/$DEB_AMD64" --arg arm64 "/src/$DEB_ARM64" \
|
||||||
|
'. + {deb_amd64: $amd64, deb_arm64: $arm64}' \
|
||||||
|
"$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||||
echo "✓ Found both .deb files"
|
echo "✓ Found both .deb files"
|
||||||
|
|
||||||
- name: Publier la release Forgejo via l'API REST
|
- name: Publier la release Forgejo via l'API REST
|
||||||
|
|
@ -227,7 +236,11 @@ jobs:
|
||||||
FORGEJO_API_URL: ${{ forgejo.api_url }}
|
FORGEJO_API_URL: ${{ forgejo.api_url }}
|
||||||
FORGEJO_REPOSITORY: ${{ forgejo.repository }}
|
FORGEJO_REPOSITORY: ${{ forgejo.repository }}
|
||||||
run: |
|
run: |
|
||||||
source "$STATE_FILE"
|
TAG=$(jq -r '.tag' "$STATE_FILE")
|
||||||
|
RELEASE_BODY=$(jq -r '.body' "$STATE_FILE")
|
||||||
|
IS_PRERELEASE=$(jq -r '.is_prerelease' "$STATE_FILE")
|
||||||
|
DEB_AMD64=$(jq -r '.deb_amd64' "$STATE_FILE")
|
||||||
|
DEB_ARM64=$(jq -r '.deb_arm64' "$STATE_FILE")
|
||||||
if [[ -z "$TAG" ]]; then
|
if [[ -z "$TAG" ]]; then
|
||||||
echo "::error::No tag resolved for the API call."
|
echo "::error::No tag resolved for the API call."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue