Skip to content

Commit 6ac364e

Browse files
Update cksolo-build-publish.yml
1 parent c15218a commit 6ac364e

File tree

1 file changed

+64
-13
lines changed

1 file changed

+64
-13
lines changed

.github/workflows/cksolo-build-publish.yml

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,77 @@ jobs:
101101
echo "solobtc-${{ steps.latest.outputs.shortsha }}" > image-tag.txt
102102
echo "${{ steps.build.outputs.digest }}" > image-digest.txt
103103
104+
- name: Build commit changelog since last release
105+
if: steps.hubcheck.outputs.skip == 'false'
106+
id: changelog
107+
env:
108+
GH_TOKEN: ${{ github.token }}
109+
run: |
110+
set -euo pipefail
111+
112+
new_full='${{ steps.latest.outputs.fullsha }}'
113+
mkdir -p _artifacts
114+
115+
# Find previous cksolo release in this repo (if any) and get its upstream SHA
116+
prev_tag=$(gh release list --limit 200 --json tagName,isDraft,isPrerelease,publishedAt \
117+
--jq '[.[] | select(.tagName | startswith("cksolo-")) | select(.isDraft==false and .isPrerelease==false)]
118+
| sort_by(.publishedAt) | last // empty | .tagName')
119+
if [ -n "${prev_tag:-}" ]; then
120+
echo "Prev release: $prev_tag"
121+
gh release download "$prev_tag" -p upstream-fullsha.txt -O _artifacts/prev-upstream-fullsha.txt
122+
prev_full=$(cat _artifacts/prev-upstream-fullsha.txt | tr -d '\r\n')
123+
else
124+
echo "No previous cksolo release found."
125+
prev_full=""
126+
fi
127+
128+
# Build commit list
129+
echo "# Changes in ckpool-solo (solobtc)" > _artifacts/release-body.md
130+
echo "" >> _artifacts/release-body.md
131+
echo "**Upstream commit:** \`${new_full}\`" >> _artifacts/release-body.md
132+
echo "" >> _artifacts/release-body.md
133+
134+
if [ -n "$prev_full" ]; then
135+
echo "Comparing range: $prev_full..$new_full"
136+
git clone --filter=blob:none https://bitbucket.org/ckolivas/ckpool-solo.git upstream
137+
cd upstream
138+
git checkout solobtc
139+
# Ensure both commits exist locally
140+
git fetch origin "$prev_full" "$new_full" --depth=1 || git fetch origin solobtc --unshallow || true
141+
echo "" >> ../_artifacts/release-body.md
142+
echo "## Commits since last release" >> ../_artifacts/release-body.md
143+
echo "" >> ../_artifacts/release-body.md
144+
# Format: shortsha subject (author)
145+
if git merge-base --is-ancestor "$prev_full" "$new_full"; then
146+
git log --no-merges --pretty=format:'- %h %s (%an)' "$prev_full..$new_full" >> ../_artifacts/release-body.md
147+
else
148+
echo "_Note: previous SHA is not an ancestor of the new SHA; showing short log of solobtc branch._" >> ../_artifacts/release-body.md
149+
git log --no-merges --pretty=format:'- %h %s (%an)' -n 50 >> ../_artifacts/release-body.md
150+
fi
151+
cd ..
152+
else
153+
echo "_First release detected. Commit list not available._" >> _artifacts/release-body.md
154+
fi
155+
156+
echo "" >> _artifacts/release-body.md
157+
echo "## Docker Hub" >> _artifacts/release-body.md
158+
echo "- https://hub.docker.com/r/${{ env.DOCKERHUB_REPO }}/tags?name=solobtc-${{ steps.latest.outputs.shortsha }}" >> _artifacts/release-body.md
159+
echo "- https://hub.docker.com/r/${{ env.DOCKERHUB_REPO }}/tags?name=latest" >> _artifacts/release-body.md
160+
echo "" >> _artifacts/release-body.md
161+
echo "## Image digest" >> _artifacts/release-body.md
162+
echo '```' >> _artifacts/release-body.md
163+
echo "${{ steps.build.outputs.digest }}" >> _artifacts/release-body.md
164+
echo '```' >> _artifacts/release-body.md
165+
104166
- name: Create GitHub Release in btc-fullnode-stack
105167
if: steps.hubcheck.outputs.skip == 'false'
106168
uses: softprops/action-gh-release@v2
107169
with:
108170
tag_name: cksolo-${{ steps.latest.outputs.shortsha }}
109171
name: CKPool Solo (solobtc @ ${{ steps.latest.outputs.shortsha }})
110172
target_commitish: ${{ github.sha }}
111-
generate_release_notes: true
112-
body: |
113-
Built from upstream branch **solobtc** at commit:
114-
https://bitbucket.org/ckolivas/ckpool-solo/commits/${{ steps.latest.outputs.fullsha }}
115-
116-
Docker Hub tags:
117-
- https://hub.docker.com/r/${{ env.DOCKERHUB_REPO }}/tags?name=solobtc-${{ steps.latest.outputs.shortsha }}
118-
- https://hub.docker.com/r/${{ env.DOCKERHUB_REPO }}/tags?name=latest
119-
120-
Image digest:
121-
```
122-
${{ steps.build.outputs.digest }}
123-
```
173+
generate_release_notes: false
174+
body_path: _artifacts/release-body.md
124175
files: |
125176
upstream-fullsha.txt
126177
image-tag.txt

0 commit comments

Comments
 (0)