Release WordPress Plugin #2
This file contains 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: Release WordPress Plugin | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: # Allow manual triggering | |
inputs: | |
tag_name: | |
description: 'Tag name to rerun' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine Tag Name | |
id: determine_tag | |
run: | | |
# Use the tag from either GITHUB_REF or the manual input | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
tag="${{ inputs.tag_name }}" | |
else | |
tag="${GITHUB_REF#refs/tags/}" | |
fi | |
echo "Tag: $tag" | |
echo "tag=$tag" >> $GITHUB_ENV | |
- name: Prepare Plugin ZIP | |
run: | | |
plugin_name=$(basename "$PWD") | |
mkdir -p "$plugin_name" | |
rsync -av --exclude-from='.distignore' ./ "$plugin_name/" | |
zip -r "${plugin_name}-${tag}.zip" "$plugin_name" | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create "$tag" \ | |
--title="Release $tag" \ | |
--draft \ | |
"${plugin_name}-${tag}.zip" |