Update all packages #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update all packages | |
on: | |
schedule: | |
# Run daily | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
jobs: | |
build-matrix: | |
name: "Build update matrix" | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.generate-matrix.outputs.include }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: generate-matrix | |
run: | | |
# Use JQ to reformat sourceMaintainers as a comma delimited list | |
MATRIX="$(jq -n 'reduce inputs as $in ([]; . + [$in | .sourceMaintainers = (.sourceMaintainers | join(","))])' packages/*.json -c)" | |
echo "include=$MATRIX" >> "$GITHUB_OUTPUT" | |
integrate-package: | |
name: Integrate "${{ matrix.recipeName }}" | |
runs-on: ubuntu-latest | |
needs: build-matrix | |
strategy: | |
matrix: | |
include: ${{ fromJson(needs.build-matrix.outputs.include) }} | |
env: | |
CI_COMMIT_AUTHOR: "pyodide-pr-bot (workflow)" | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Git | |
run: | | |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | |
git config --global user.email "username@users.noreply.github.com" | |
- name: Determine latest SHA256 | |
id: marker | |
run: | | |
latest_sha=$(curl "https://pypi.org/pypi/${{ matrix.recipeName }}/json" -s | jq '.urls[] | select (.packagetype == "sdist").digests.sha256' --raw-output) | |
echo "sha256=${latest_sha}" >> "$GITHUB_OUTPUT" | |
test -f ".hashes/${{ matrix.recipeName }}-${latest_sha}" && echo "marker-exists=1" >> "$GITHUB_OUTPUT" || true | |
- name: Setup Python | |
if: ${{ !steps.marker.outputs.marker-exists }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Install dependencies | |
if: ${{ !steps.marker.outputs.marker-exists }} | |
run: python3 -m pip install -r requirements.txt | |
- name: Create marker | |
if: ${{ !steps.marker.outputs.marker-exists }} | |
run: | | |
marker=".hashes/${{ matrix.recipeName }}-${{ steps.marker.outputs.sha256 }}" | |
touch "${marker}" | |
git add "${marker}" | |
git commit -m "Add marker for ${{ matrix.recipeName }} (SHA256 ${{ steps.marker.outputs.sha256 }})" | |
git push | |
- name: Create PR | |
if: ${{ !steps.marker.outputs.marker-exists }} | |
run: >- | |
python3 integrate-pr | |
--repo "${{ matrix.sourceRepo }}" | |
--package "${{ matrix.packageName }}" | |
--recipe "${{ matrix.recipeName }}" | |
${{ matrix.prAsReady && '--ready-for-review' || '--not-ready-for-review' }} | |
--maintainers "${{ matrix.sourceMaintainers }}" | |
--commit 'Update {recipe} to {version}' | |
--title "${{ matrix.prTitlePattern || 'Upgrade {recipe} to {version}' }}" | |
--body "${{ matrix.prBodyPattern || 'This PR was created by a bot. Pinging {maintainers} to check this' }}" |