Skip to content

Copy Changelog to Website on Tag Push #3

Copy Changelog to Website on Tag Push

Copy Changelog to Website on Tag Push #3

name: Copy Changelog to Website on Tag Push
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
copy-file:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repository
uses: actions/checkout@v4
- name: Checkout Target Repository
uses: actions/checkout@v4
with:
repository: repooc/repoocreforged-wiki
ref: main
show-progress: true
token: ${{ secrets.UPDATE_CHANGELOGS }}
path: ./repoocreforged-wiki
- name: Transform Repository Name
id: transform
if: success()
run: |
repo_name=$(basename $GITHUB_REPOSITORY)
dest_name=$(echo $repo_name | sed 's/^ElvUI_//' | tr '[:upper:]' '[:lower:]')
echo "repository_name=$repo_name" >> $GITHUB_ENV
echo "destination_name=$dest_name" >> $GITHUB_ENV
- name: Copy File to Target Repository
if: success()
run: |
cp CHANGELOG.md ./repoocreforged-wiki/src/changelogs/${destination_name}.md
cd repoocreforged-wiki
git status
- name: Check for Changes
id: check_changes
if: success()
run: |
cd repoocreforged-wiki
git add src/changelogs/${destination_name}.md
if git diff --cached --quiet; then
echo "No changes detected"
echo "changes=false" >> $GITHUB_ENV
else
echo "Changes detected"
echo "changes=true" >> $GITHUB_ENV
fi
- name: Debug Check Changes Output
if: success()
run: |
echo "Changes detected: ${{ env.changes }}"
- name: Commit and Push Changes
if: ${{ env.changes == 'true' }}
run: |
cd repoocreforged-wiki
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add .
git commit -m "Update changelog file for ${repository_name} on tag push: $GITHUB_REF"
git push origin main
curl -X POST ${{ secrets.DEPLOY_WEBSITE }}
env:
GITHUB_TOKEN: ${{ secrets.UPDATE_CHANGELOGS }}