All checks were successful
Create Release / build (push) Successful in 3s
The workflow was only updating the Version comment but not the TWP_VERSION constant, causing the local repository to show the placeholder while releases showed the actual version. Now updates both: - Version: header comment - TWP_VERSION constant This matches the release.yml workflow and ensures version consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
name: Update Plugin Version
|
|
|
|
on:
|
|
release:
|
|
types: [created, edited]
|
|
|
|
jobs:
|
|
update-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get release tag
|
|
id: get_tag
|
|
run: echo "TAG=${GITEA_REF#refs/tags/}" >> $GITEA_ENV
|
|
|
|
- name: Update version in plugin file
|
|
run: |
|
|
# Replace version in main plugin file (both header and constant)
|
|
sed -i "s/Version: {auto_update_value_on_deploy}/Version: ${{ env.TAG }}/" twilio-wp-plugin.php
|
|
sed -i "s/TWP_VERSION', '{auto_update_value_on_deploy}/TWP_VERSION', '${{ env.TAG }}/" twilio-wp-plugin.php
|
|
|
|
# Verify changes
|
|
grep "Version:" twilio-wp-plugin.php
|
|
grep "TWP_VERSION" twilio-wp-plugin.php
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
git config --local user.email "action@gitea.com"
|
|
git config --local user.name "Gitea Action"
|
|
git add twilio-wp-plugin.php
|
|
git commit -m "Update version to ${{ env.TAG }}" || echo "No changes to commit"
|
|
git push || echo "Nothing to push"
|
|
|
|
- name: Create plugin zip
|
|
run: |
|
|
mkdir -p /tmp/twilio-wp-plugin
|
|
rsync -av --exclude=".git" --exclude=".gitea" --exclude="build" . /tmp/twilio-wp-plugin/
|
|
cd /tmp
|
|
zip -r $GITEA_WORK_DIR/twilio-wp-plugin.zip twilio-wp-plugin
|
|
|
|
- name: Upload zip to release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
with:
|
|
upload_url: ${{ gitea.event.release.upload_url }}
|
|
asset_path: twilio-wp-plugin.zip
|
|
asset_name: twilio-wp-plugin.zip
|
|
asset_content_type: application/zip
|