Update data #669
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 data | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 5 * * *' | |
workflow_dispatch: # | |
env: | |
submodule_owner: ShiftMediaProject | |
submodule_folder: SMP | |
jobs: | |
check_smp: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
submodule: | |
- fontconfig | |
- freetype2 | |
- fribidi | |
- harfbuzz | |
- libass | |
- libiconv | |
- liblzma | |
- libxml2 | |
- zlib | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Set submodule current | |
run: | | |
git submodule update --init --recursive "${{ env.submodule_folder }}/${{ matrix.submodule }}" | |
cd ${{ env.submodule_folder }}/${{ matrix.submodule }} | |
echo SUBMODULE_NAME=${{ matrix.submodule }} >> $GITHUB_ENV | |
echo SUBMODULE_REV=$(git describe --tags --first-parent --abbrev=7 --long --dirty) >> $GITHUB_ENV | |
echo SUBMODULE_SHA=$(git rev-parse HEAD) >> $GITHUB_ENV | |
- name: Get submodule current remote | |
id: current | |
uses: cardinalby/git-get-release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
repo: ${{ env.submodule_owner }}/${{ matrix.submodule }} | |
commitSha: ${{ env.SUBMODULE_SHA }} | |
doNotFailIfNotFound: true | |
- name: Get submodule latest remote | |
id: latest | |
uses: cardinalby/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
repo: ${{ env.submodule_owner }}/${{ matrix.submodule }} | |
latest: true | |
prerelease: false | |
doNotFailIfNotFound: true | |
- name: Set submodule current remote | |
if: steps.current.outputs.tag_name != '' | |
run: echo SUBMODULE_REV=${{ steps.current.outputs.tag_name }} >> $GITHUB_ENV | |
- name: Check if need update | |
if: | | |
steps.latest.outputs.tag_name != '' && | |
steps.current.outputs.tag_name == '' || | |
steps.latest.outputs.tag_name != '' && | |
steps.current.outputs.tag_name != steps.latest.outputs.tag_name | |
run: | | |
cd ${{ env.submodule_folder }}/${{ matrix.submodule }} | |
git checkout ${{ steps.latest.outputs.tag_name }} | |
echo NEED_UPDATE=1 >> $GITHUB_ENV | |
- name: Run update | |
if: ${{ env.NEED_UPDATE }} == '1' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: Update ${{ matrix.submodule }} to ${{ steps.latest.outputs.tag_name }} | |
branch: submodule-update-${{ matrix.submodule }} | |
base: master | |
delete-branch: true | |
title: Update ${{ matrix.submodule }} (${{ env.SUBMODULE_REV }} to ${{ steps.latest.outputs.tag_name }}) | |
body: | | |
Update ${{ matrix.submodule }} to ${{ steps.latest.outputs.tag_name }} | |
Current: ${{ env.SUBMODULE_REV }} |