Add workflow to update version number on release
All checks were successful
Create Release / build (push) Successful in 2s

This commit is contained in:
jknapp 2025-04-22 20:28:17 +00:00
parent c392af46e7
commit 0d0cb65633

View File

@ -0,0 +1,49 @@
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
sed -i "s/Version: .*/Version: ${{ env.TAG }}/" fw-store-embed.php
# Verify change
grep "Version:" fw-store-embed.php
- name: Commit changes
run: |
git config --local user.email "action@gitea.com"
git config --local user.name "Gitea Action"
git add fw-store-embed.php
git commit -m "Update version to ${{ env.TAG }}"
git push
- name: Create plugin zip
run: |
mkdir -p build
zip -r build/fourthwall-store-embed.zip . -x ".git/*" ".gitea/*" "build/*" "*.git*"
- 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: build/fourthwall-store-embed.zip
asset_name: fourthwall-store-embed.zip
asset_content_type: application/zip