diff --git a/.gitea/workflows/update-version.yml b/.gitea/workflows/update-version.yml new file mode 100644 index 0000000..95368e8 --- /dev/null +++ b/.gitea/workflows/update-version.yml @@ -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 \ No newline at end of file