Skip to content

Autoupdate Cosmopolitan #89

Autoupdate Cosmopolitan

Autoupdate Cosmopolitan #89

name: Autoupdate Cosmopolitan
on:
workflow_dispatch:
schedule:
- cron: "15 4 * * *"
permissions:
contents: write
pull-requests: write
jobs:
check_new_releases:
name: Check for new releases
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check versions
run: |
CURRENT=$(cat .github/cosmocc_version.txt)
LATEST=$(curl -s -S -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/jart/cosmopolitan/releases | jq -r .[0].tag_name)
echo "current=${CURRENT}" >> "$GITHUB_ENV"
echo "latest=${LATEST}" >> "$GITHUB_ENV"
- name: Do update
if: ${{ env.current != env.latest }}
run: |
sed -i 's/${{ env.current }}/${{ env.latest }}/g' .github/cosmocc_version.txt
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
commit-message: 'Bump Cosmopolitan to ${{ env.latest }}'
title: '[🤖] Bump Cosmopolitan to ${{ env.latest }}'
body: Automatically generated PR - Bumping Cosmopolitan from ${{ env.current }} to ${{ env.latest }}
branch: bump-cosmocc
delete-branch: true