Skip to content

Workflow file for this run

name: Update Plugin JSON and Sync Versions
on:
release:
types: [published]
jobs:
update-json-and-sync-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main # Explicitly check out the main branch
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "14"
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
- name: Install dependencies
run: |
npm install
composer install --no-dev --prefer-dist
- name: Sync version in files
run: npm run sync-version # Assuming you have a script that syncs versions
- name: Update JSON file
run: |
version="${{ github.event.release.tag_name }}"
version="${version#v}"
download_url="https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/convoworks-gpt-v${version}.zip"
updated_date=$(date -u +"%Y-%m-%d")
cat > update.json <<EOL
{
"convoworks-gpt/convoworks-gpt.php": {
"version": "${version}",
"package": "${download_url}",
"requires": "5.0",
"tested": "6.6",
"last_updated": "${updated_date}"
}
}
EOL
- name: Commit and push updated files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add update.json composer.json convoworks-gpt.php
git commit -m "Sync version and update JSON for release ${{ github.event.release.tag_name }}"
git push origin main