CI / CI (push) Canceled after 11m29s
The 'Upload release assets via Gitea API' step embedded a JSON
heredoc inside a YAML block scalar (run: |). Gitea's YAML parser
bailed at line 51 with 'could not find expected :'' when it saw
the leading '{' of the JSON body — it tried to interpret the
heredoc content as a flow mapping instead of literal text.
Fix: move the release logic into .github/scripts/create-release.sh
and pass the GitHub Actions context values as env vars. The step
becomes:
env:
GITEA_TOKEN: ...
TAG_NAME: ...
API_URL: ...
REPOSITORY: ...
SHA: ...
run: ./.github/scripts/create-release.sh
Validates cleanly with PyYAML (yaml.safe_load). Pattern matches
bark-notify.sh from earlier — CI helpers live in .github/scripts/,
workflows stay slim.
Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
|
|
jobs:
|
|
ci:
|
|
name: CI
|
|
# `astral-uv` is a self-hosted runner with uv pre-installed, so we can
|
|
# skip the setup-uv step entirely. pyproject.toml's
|
|
# [tool.hatch.build.hooks.jupyter-builder] handles jlpm install +
|
|
# jlpm build:prod before wheel assembly.
|
|
runs-on: astral-uv
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build package
|
|
run: uv build
|
|
|
|
- name: Upload wheel artifacts
|
|
if: success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: snapshot-dist
|
|
path: dist/snapshot-*
|
|
if-no-files-found: error
|
|
|
|
# Only create a release + attach dist/ assets when pushing a v* tag.
|
|
# On branch pushes / pull requests this step is skipped entirely.
|
|
# The release logic is in a separate script to avoid embedding a JSON
|
|
# heredoc inside a YAML block scalar (the previous version of this
|
|
# step was rejected by Gitea's YAML parser at line 51).
|
|
- name: Upload release assets via Gitea API
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG_NAME: ${{ github.ref_name }}
|
|
API_URL: ${{ github.api_url }}
|
|
REPOSITORY: ${{ github.repository }}
|
|
SHA: ${{ github.sha }}
|
|
run: ./.github/scripts/create-release.sh
|
|
|
|
# Always run, regardless of job status. The script is a side-effect;
|
|
# if the notification itself fails we swallow the error so CI does
|
|
# not turn red on a Bark outage.
|
|
- name: Notify Bark
|
|
if: always()
|
|
run: |
|
|
if [ "${{ job.status }}" = "success" ]; then
|
|
TITLE="✅ CI: ${{ github.repository }}@${{ github.ref_name }}"
|
|
BODY="Build OK for ${{ github.sha }} by ${{ github.actor }}"
|
|
else
|
|
TITLE="❌ CI: ${{ github.repository }}@${{ github.ref_name }}"
|
|
BODY="Build FAILED for ${{ github.sha }} by ${{ github.actor }}"
|
|
fi
|
|
./.github/scripts/bark-notify.sh "$TITLE" "$BODY" || echo "Bark notify failed (non-fatal)"
|