Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
id: inputs
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
# Title format: "publish: owner/repo@VERSION"
VERSION=$(echo "$ISSUE_TITLE" | grep -oP '@\K[^\s]+$')
Expand All @@ -34,6 +35,26 @@ jobs:
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

# Craft itself never reads the issue: the "### Targets" checklist is
# honoured by translating it into explicit `--target` flags. Checked
# boxes mean "already done, skip"; when everything is checked we pass
# the special target `none`, which runs only the post-publish steps
# (tag, merge the release branch back, delete it).
TARGETS_SECTION=$(echo "$ISSUE_BODY" | sed -n '/### Targets/,/Checked targets will be skipped/p')
PENDING=$(echo "$TARGETS_SECTION" | grep -oP '^\s*-\s*\[ \]\s+\K\S+' || true)
ALL=$(echo "$TARGETS_SECTION" | grep -oP '^\s*-\s*\[[ xX]\]\s+\K\S+' || true)
TARGET_ARGS=""
if [[ -n "$ALL" && "$PENDING" != "$ALL" ]]; then
if [[ -z "$PENDING" ]]; then
TARGET_ARGS="--target none"
else
while read -r target; do
TARGET_ARGS+=" --target $target"
done <<< "$PENDING"
fi
fi
echo "target_args=$TARGET_ARGS" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v6
with:
ref: release/${{ steps.inputs.outputs.version }}
Expand Down Expand Up @@ -71,7 +92,7 @@ jobs:
sudo chmod +x /usr/local/bin/craft

- name: Publish
run: craft publish "${{ steps.inputs.outputs.version }}" --no-input
run: craft publish "${{ steps.inputs.outputs.version }}" --no-input ${{ steps.inputs.outputs.target_args }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}

Expand Down
Loading