sync-readme #33
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: '📚 Sync mod.io README and Images' | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [ sync-readme ] | |
jobs: | |
sync_modio: | |
runs-on: ubuntu-latest | |
name: 'Sync mod.io README and Images' | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get README | |
id: get-readme | |
run: | | |
result=$(pwsh ./src/get-version-table.ps1 -ProjectFilePath "./src/jcdcdev.Eco.Core.csproj" -PackageId "jcdcdev.Eco.Core") | |
{ | |
echo 'result<<EOF' | |
echo "${result}" | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Update README | |
shell: pwsh | |
run: | | |
$result = "${{ steps.get-readme.outputs.result }}" | |
git config user.name "$env:GITHUB_ACTOR" | |
git config user.email "$env:GITHUB_ACTOR_ID+$env:[email protected]" | |
$readme = Get-Content -Path ".github/README.md" -Raw | |
$regex = '(## Version Table[\S\s]*)' | |
$newReadme = $readme -replace $regex, "## Version Table`n$result" | |
Write-Host "new readme=$newReadme" | |
if ($newReadme -eq $readme) { | |
Write-Host "No changes to README" | |
exit 0 | |
} | |
Set-Content -Path ".github/README.md" -Value $newReadme | |
git add .github/README.md | |
git commit -m "doc: Update version table" | |
git push origin | |
- name: Sync with mod.io | |
uses: jcdcdev/jcdcdev.Github.ModioSyncDocs@main | |
with: | |
logo-path: "docs/logo.png" | |
images-path: "docs/screenshots" | |
readme-path: ".github/README.md" | |
project-author: "JCDC DEV" | |
project-name: "CORE" | |
imejis-generate-image: true | |
imejis-design-id: "${{ secrets.DESIGN_ID }}" | |
imejis-key: "${{ secrets.IMEJIS_KEY }}" | |
modio-game: "${{ secrets.MODIO_GAME }}" | |
modio-mod: "${{ secrets.MODIO_MOD }}" | |
modio-token: "${{ secrets.MODIO_TOKEN }}" | |