2024-02-02 22:28:03 +01:00
|
|
|
name: Update CImg
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: 0 0 3 * * # The first day after this workflow was merged
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
check-version:
|
|
|
|
name: Check for updates
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
latest-tag: ${{ steps.latest-tag.outputs.result }}
|
|
|
|
steps:
|
|
|
|
- name: Fetch the latest tag (could be buggy)
|
|
|
|
uses: actions/github-script@v7
|
|
|
|
id: latest-tag
|
|
|
|
with:
|
|
|
|
result-encoding: string
|
|
|
|
script: |
|
|
|
|
return (await github.rest.repos.listTags({ owner: 'GreycLab', repo: 'CImg', per_page: 28 })).data[27].name
|
|
|
|
pull-file:
|
|
|
|
name: Update CImg.h
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: check-version
|
2024-06-03 02:28:47 +02:00
|
|
|
if: ${{ needs.check-version.outputs.latest-tag != 'v.3.3.6' }}
|
2024-02-02 22:28:03 +01:00
|
|
|
steps:
|
2024-04-03 04:22:36 +02:00
|
|
|
- uses: actions/checkout@v2
|
2024-02-02 22:28:03 +01:00
|
|
|
name: Checkout this repository
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CIMG_UPDATE_TOKEN }}
|
|
|
|
- name: Download new CImg version
|
|
|
|
uses: carlosperate/download-file-action@v2
|
|
|
|
with:
|
|
|
|
file-url: 'https://github.com/GreycLab/CImg/raw/${{ needs.check-version.outputs.latest-tag }}/CImg.h'
|
|
|
|
location: 'src'
|
|
|
|
- name: Commit new CImg version (and update script)
|
|
|
|
run: |
|
2024-06-03 02:28:47 +02:00
|
|
|
sed -i 's/v.3.3.6/${{ needs.check-version.outputs.latest-tag }}/' .github/workflows/cimg.yml
|
2024-02-02 22:28:03 +01:00
|
|
|
git config user.name 'GitHub Actions'
|
|
|
|
git config user.email 'actions@github.com'
|
|
|
|
git commit -am "Update CImg to ${{ needs.check-version.outputs.latest-tag }}"
|
|
|
|
git push
|