libostree-dev/.forgejo/workflows/update-readme.yml
robojerk 46de31a373
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m19s
added files
2025-07-21 03:08:18 +00:00

120 lines
No EOL
4.3 KiB
YAML

name: Update README with Download Links
on:
workflow_run:
workflows: ["Build libostree Backport"]
types: [completed]
branches: [ main, master ]
jobs:
update-readme:
name: Update README with Download Links
runs-on: ubuntu-latest
container:
image: ubuntu:latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Setup environment
run: |
apt update -y
apt install -y git curl
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* .
cp -r /tmp/libostree-dev/.* . 2>/dev/null || true
- name: Get workflow run artifacts
run: |
# Get the workflow run ID from the triggering workflow
WORKFLOW_RUN_ID=${{ github.event.workflow_run.id }}
REPO_OWNER="robojerk"
REPO_NAME="libostree-dev"
echo "Workflow Run ID: $WORKFLOW_RUN_ID"
echo "Repository: $REPO_OWNER/$REPO_NAME"
# Create artifacts directory
mkdir -p artifacts
# Download artifacts from the workflow run
# Note: This is a placeholder - actual artifact download would depend on Forgejo API
echo "Downloading artifacts from workflow run $WORKFLOW_RUN_ID..."
# For now, we'll create a placeholder that shows the expected structure
echo "libostree-dev_2025.2-1~noble1_amd64.deb" > artifacts/package-list.txt
echo "libostree-dev-dbgsym_2025.2-1~noble1_amd64.ddeb" >> artifacts/package-list.txt
- name: Update README with download links
run: |
# Get current date
BUILD_DATE=$(date '+%Y-%m-%d %H:%M:%S UTC')
# Create download section
cat > download-section.md << EOF
## 📦 Download Latest Build
**Last Built**: $BUILD_DATE
**Version**: 2025.2-1~noble1
**Target**: Ubuntu Noble (24.04 LTS)
### Download Links
EOF
# Add download links for each package
if [ -f "artifacts/package-list.txt" ]; then
while IFS= read -r package; do
if [[ $package == *.deb ]]; then
echo "- **$package** - [Download](https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts)" >> download-section.md
fi
done < artifacts/package-list.txt
else
echo "- **libostree-dev_2025.2-1~noble1_amd64.deb** - [Download](https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts)" >> download-section.md
fi
cat >> download-section.md << EOF
### Installation
\`\`\`bash
# Download and install the package
wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.event.workflow_run.id }}/artifacts
sudo dpkg -i libostree-dev_2025.2-1~noble1_amd64.deb
sudo apt-get install -f # Install any missing dependencies
\`\`\`
### Verification
\`\`\`bash
# Check if libostree 2025.2-1 is installed
pkg-config --modversion ostree-1
# Should output: 2025.2
\`\`\`
---
EOF
# Update the README
# Find the line after the main description and insert the download section
awk '/## Usage/{print; system("cat download-section.md"); next} 1' README.md > README.md.tmp
mv README.md.tmp README.md
echo "README updated with download links"
- name: Commit and push changes
run: |
# Configure git
git config --global user.email "ci@raines.xyz"
git config --global user.name "CI Bot"
# Add and commit changes
git add README.md
git commit -m "Update README with download links from workflow run ${{ github.event.workflow_run.id }}"
# Push changes
git push origin main