Sync repo #43
This file contains hidden or 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 repo | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| name: | |
| description: 'Branch' | |
| required: true | |
| default: 'main' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync-original: | |
| name: Sync the exiftool repo | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: sync the repo | |
| id: sync-original | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Woss Bot" | |
| rm -rf exiftool_git | |
| git clone https://github.com/exiftool/exiftool.git exiftool_git | |
| rm -rf exiftool_git/.git | |
| cd ./exiftool_git || exit | |
| perl Makefile.PL | |
| make | |
| make test | |
| cd ../ | |
| mkdir -p ./exiftool | |
| cp -R ./exiftool_git/lib ./exiftool_git/exiftool ./exiftool | |
| chmod +x ./exiftool/exiftool | |
| rm -rf exiftool_git | |
| VERSION=$(./exiftool/exiftool -ver) | |
| echo "Version: ${VERSION}" | |
| git checkout -b "v${VERSION}" | |
| git add exiftool | |
| git commit -m "Update exiftool to version ${VERSION}" | |
| git push --set-upstream origin "v${VERSION}" | |
| echo "branchName=v${VERSION}" >> $GITHUB_OUTPUT | |
| - name: create pull request | |
| run: gh pr create --assignee woss -B main -H ${{ steps.sync-original.outputs.branchName }} --title "Update exiftool to version ${{ steps.sync-original.outputs.branchName }}" --body "This PR updates the exiftool to version ${{ steps.sync-original.outputs.branchName }}." | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: merge pull request | |
| run: gh pr merge ${{ steps.sync-original.outputs.branchName }} --merge --delete-branch | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: git pull | |
| run: git pull | |
| - name: create tag | |
| run: | | |
| git tag -a "${{ steps.sync-original.outputs.branchName }}" -m "Update exiftool to version ${{ steps.sync-original.outputs.branchName }}" | |
| git push origin "${{ steps.sync-original.outputs.branchName }}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: git pull | |
| run: git pull | |
| - name: generate release | |
| run: | | |
| gh release create ${{ steps.sync-original.outputs.branchName }} --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Tell to world | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const response = await fetch("${{secrets.N8N_WEBHOOK_URL}}", { | |
| method: 'post', | |
| body: JSON.stringify({tag: '${{steps.sync-original.outputs.branchName}}'}), | |
| headers: {'Content-Type': 'application/json','x-api-token':'${{ secrets.N8N_WEBHOOK_TOKEN }}'} | |
| }); | |
| const data = await response.json(); | |
| console.log('data', data) |