Some checks failed
Build Packages / Build libostree Backport (push) Failing after 0s
Build Packages / Build bootc Package (push) Has been skipped
Test Build / Test bootc Build (with existing libostree) (push) Failing after 0s
Build Packages / Create Release (push) Has been skipped
Build Packages / Create Artifacts for README Update (push) Has been skipped
175 lines
No EOL
6.6 KiB
YAML
175 lines
No EOL
6.6 KiB
YAML
name: Update README with Download Links
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Build Packages"]
|
|
types: [completed]
|
|
branches: [main, master]
|
|
|
|
jobs:
|
|
update-readme:
|
|
name: Update README with Artifact Links
|
|
runs-on: ubuntu-24.04
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Download artifacts from previous workflow
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-assets
|
|
path: /tmp/artifacts
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Generate download links
|
|
run: |
|
|
python3 << 'EOF'
|
|
import os
|
|
import re
|
|
from datetime import datetime
|
|
|
|
# Get artifact files
|
|
artifact_dir = "/tmp/artifacts"
|
|
files = []
|
|
if os.path.exists(artifact_dir):
|
|
for file in os.listdir(artifact_dir):
|
|
if file.endswith('.deb'):
|
|
files.append(file)
|
|
|
|
# Generate download links
|
|
base_url = f"https://github.com/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}/artifacts"
|
|
|
|
print("## 📦 Latest Packages")
|
|
print()
|
|
print("> **Note**: These packages are automatically built by CI/CD. For the latest version, check the [Actions tab](https://github.com/$GITHUB_REPOSITORY/actions).")
|
|
print()
|
|
|
|
if files:
|
|
print("### Download Links")
|
|
print()
|
|
print("| Package | Download |")
|
|
print("|---------|----------|")
|
|
|
|
for file in sorted(files):
|
|
if 'libostree' in file:
|
|
package_name = "libostree Backport"
|
|
elif 'bootc' in file:
|
|
package_name = "bootc"
|
|
else:
|
|
package_name = file
|
|
|
|
print(f"| {package_name} | [{file}]({base_url}) |")
|
|
|
|
print()
|
|
print("### Installation Instructions")
|
|
print()
|
|
print("```bash")
|
|
print("# Download and install libostree backport first")
|
|
print("wget <libostree-package-url>")
|
|
print("sudo dpkg -i <libostree-package-name>.deb")
|
|
print("sudo apt --fix-broken install -y")
|
|
print()
|
|
print("# Then install bootc")
|
|
print("wget <bootc-package-url>")
|
|
print("sudo dpkg -i <bootc-package-name>.deb")
|
|
print("sudo apt --fix-broken install -y")
|
|
print("```")
|
|
print()
|
|
print(f"*Last updated: {datetime.now().strftime('%Y-%m-%d %H:%M UTC')}*")
|
|
else:
|
|
print("No packages found in artifacts.")
|
|
print()
|
|
print("Check the [Actions tab](https://github.com/$GITHUB_REPOSITORY/actions) for build status.")
|
|
EOF
|
|
|
|
# Save to file
|
|
python3 << 'EOF' > /tmp/download_section.md
|
|
import os
|
|
import re
|
|
from datetime import datetime
|
|
|
|
# Get artifact files
|
|
artifact_dir = "/tmp/artifacts"
|
|
files = []
|
|
if os.path.exists(artifact_dir):
|
|
for file in os.listdir(artifact_dir):
|
|
if file.endswith('.deb'):
|
|
files.append(file)
|
|
|
|
# Generate download links
|
|
base_url = f"https://github.com/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}/artifacts"
|
|
|
|
print("## 📦 Latest Packages")
|
|
print()
|
|
print("> **Note**: These packages are automatically built by CI/CD. For the latest version, check the [Actions tab](https://github.com/$GITHUB_REPOSITORY/actions).")
|
|
print()
|
|
|
|
if files:
|
|
print("### Download Links")
|
|
print()
|
|
print("| Package | Download |")
|
|
print("|---------|----------|")
|
|
|
|
for file in sorted(files):
|
|
if 'libostree' in file:
|
|
package_name = "libostree Backport"
|
|
elif 'bootc' in file:
|
|
package_name = "bootc"
|
|
else:
|
|
package_name = file
|
|
|
|
print(f"| {package_name} | [{file}]({base_url}) |")
|
|
|
|
print()
|
|
print("### Installation Instructions")
|
|
print()
|
|
print("```bash")
|
|
print("# Download and install libostree backport first")
|
|
print("wget <libostree-package-url>")
|
|
print("sudo dpkg -i <libostree-package-name>.deb")
|
|
print("sudo apt --fix-broken install -y")
|
|
print()
|
|
print("# Then install bootc")
|
|
print("wget <bootc-package-url>")
|
|
print("sudo dpkg -i <bootc-package-name>.deb")
|
|
print("sudo apt --fix-broken install -y")
|
|
print("```")
|
|
print()
|
|
print(f"*Last updated: {datetime.now().strftime('%Y-%m-%d %H:%M UTC')}*")
|
|
else:
|
|
print("No packages found in artifacts.")
|
|
print()
|
|
print("Check the [Actions tab](https://github.com/$GITHUB_REPOSITORY/actions) for build status.")
|
|
EOF
|
|
|
|
- name: Update README
|
|
run: |
|
|
# Create backup
|
|
cp README.md README.md.backup
|
|
|
|
# Find the download section in README
|
|
if grep -q "## 📦 Latest Packages" README.md; then
|
|
# Replace existing download section
|
|
awk '/^## 📦 Latest Packages/{exit} {print}' README.md > README.md.tmp
|
|
cat README.md.tmp /tmp/download_section.md > README.md
|
|
rm README.md.tmp
|
|
else
|
|
# Add download section after the first section
|
|
awk '/^## 🚀 Quick Start/{print; print ""; system("cat /tmp/download_section.md"); next} {print}' README.md > README.md.tmp
|
|
mv README.md.tmp README.md
|
|
fi
|
|
|
|
- name: Commit and push changes
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git add README.md
|
|
git diff --quiet && git diff --staged --quiet || git commit -m "Update README with latest package download links [skip ci]"
|
|
git push |