6464 build/rootfs-profile.md
6565 if-no-files-found : error
6666
67+ - name : download master baseline
68+ if : github.event_name == 'pull_request'
69+ env :
70+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+ run : |
72+ mkdir -p baseline
73+ RUN_ID=$(gh run list --workflow=build.yml --branch=master \
74+ --status=success --limit=1 --json databaseId --jq '.[0].databaseId')
75+ if [ -n "$RUN_ID" ]; then
76+ gh run download "$RUN_ID" --name rootfs-profile --dir baseline/ || true
77+ fi
78+
79+ - name : post PR comment
80+ if : github.event_name == 'pull_request'
81+ env :
82+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83+ run : |
84+ # Generate diff (gracefully handles missing baseline)
85+ DIFF_MD=$(./vamos profile diff baseline/rootfs-profile.json build/rootfs-profile.json 2>/dev/null || echo "No baseline available")
86+ PROFILE_MD=$(cat build/rootfs-profile.md)
87+
88+ # Assemble comment with hidden marker for find-and-update
89+ printf -v COMMENT_BODY '%s\n%s\n\n%s\n%s\n\n---\n\n%s' \
90+ '<!-- rootfs-profile-bot -->' \
91+ '## vamOS System Profile' \
92+ '### Changes vs master' \
93+ "$DIFF_MD" \
94+ "$PROFILE_MD"
95+
96+ # Find existing comment by marker
97+ COMMENT_ID=$(gh api \
98+ "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
99+ --jq '.[] | select(.body | contains("<!-- rootfs-profile-bot -->")) | .id' \
100+ | head -1)
101+
102+ if [ -n "$COMMENT_ID" ]; then
103+ gh api "repos/${{ github.repository }}/issues/comments/$COMMENT_ID" \
104+ -X PATCH -f body="$COMMENT_BODY"
105+ else
106+ gh pr comment "${{ github.event.pull_request.number }}" --body "$COMMENT_BODY"
107+ fi
108+
67109 release :
68110 if : github.event_name == 'push'
69111 needs : [build-kernel, build-system]
@@ -87,48 +129,16 @@ jobs:
87129 name : system.erofs.img
88130 path : build/
89131
90- - name : check deploy key
91- id : check-key
92- run : |
93- if [ -n "${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}" ]; then
94- echo "has_key=true" >> $GITHUB_OUTPUT
95- else
96- echo "has_key=false" >> $GITHUB_OUTPUT
97- echo "::warning::VAMOS_IMAGES_DEPLOY_KEY secret is not set — skipping image publish and release."
98- fi
99-
100132 - name : generate manifest
101- if : steps.check-key.outputs.has_key == 'true'
133+ env :
134+ RELEASE_URL : https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}
102135 run : |
103136 VERSION=$(cat userspace/root/VERSION)
104137 echo "VERSION=$VERSION" >> $GITHUB_ENV
105- IMAGES_URL="https://github.com/${{ github.repository_owner }}/vamos-images/raw/v${VERSION}"
106- IMAGES_URL=$IMAGES_URL python3 tools/build/package_ota.py
107-
108- - name : push images to vamos-images
109- if : steps.check-key.outputs.has_key == 'true'
110- uses : actions/checkout@v4
111- with :
112- repository : ${{ github.repository_owner }}/vamos-images
113- ssh-key : ${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}
114- path : vamos-images
115-
116- - name : commit and tag images
117- if : steps.check-key.outputs.has_key == 'true'
118- run : |
119- TAG="v${VERSION}"
120- cd vamos-images
121- git checkout --orphan release
122- cp ../build/ota/*.img* .
123- cp ../build/ota/manifest.json .
124- git add .
125- git -c user.name="github-actions" -c user.email="actions@github.com" \
126- commit -m "release images for $TAG"
127- git tag "$TAG"
128- git push origin "refs/tags/$TAG" --force
138+ RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}"
139+ RELEASE_URL=$RELEASE_URL python3 tools/build/package_ota.py
129140
130141 - name : create release
131- if : steps.check-key.outputs.has_key == 'true'
132142 env :
133143 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134144 run : |
@@ -139,22 +149,10 @@ jobs:
139149 git tag -d "$TAG" 2>/dev/null || true
140150 git push origin ":refs/tags/$TAG" 2>/dev/null || true
141151
142- MANIFEST_URL="https://github.com/${{ github.repository_owner }}/vamos-images/raw/${TAG}/manifest.json"
143-
144- # Create release linking to manifest
145- NOTES="Automated release from commit ${{ github.sha }}
146-
147- Manifest: ${MANIFEST_URL}"
152+ # Create release with all images and manifest
148153 gh release create "$TAG" \
149154 --title "vamOS $TAG" \
150155 --target "${{ github.sha }}" \
151- --notes "$NOTES"
152-
153- - name : post setup instructions
154- if : steps.check-key.outputs.has_key == 'false'
155- run : |
156- echo "::warning::VAMOS_IMAGES_DEPLOY_KEY is not configured. To enable image publishing:"
157- echo "::warning::1. Create a ${{ github.repository_owner }}/vamos-images repo"
158- echo "::warning::2. Generate an SSH deploy key: ssh-keygen -t ed25519 -f vamos-images-deploy-key -N \"\""
159- echo "::warning::3. Add the public key to ${{ github.repository_owner }}/vamos-images as a deploy key with write access"
160- echo "::warning::4. Add the private key as VAMOS_IMAGES_DEPLOY_KEY secret in ${{ github.repository }}"
156+ --notes "Automated release from commit ${{ github.sha }}" \
157+ build/ota/*.img \
158+ build/ota/manifest.json
0 commit comments