Skip to content

Commit

Permalink
Merge pull request #25 from vplugins/dev
Browse files Browse the repository at this point in the history
Responses update and deployment
  • Loading branch information
rajanvijayan authored Sep 16, 2024
2 parents 9264e29 + 0f1d6fd commit c2d5f17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version name for the release'
description: 'Version name for the release (e.g., 1.0.0)'
required: true
default: '1.0.0'

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -26,25 +26,31 @@ jobs:
run: composer install --no-dev

- name: Get version from user input
run: echo "VERSION=${{ github.event.inputs.version || '1.0.0' }}" >> $GITHUB_ENV
run: |
VERSION=${{ github.event.inputs.version }}
# Ensure that the version is prefixed with "v" for a valid tag name
if [[ $VERSION != v* ]]; then
VERSION="v${VERSION}"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Cleanup unnecessary files
run: |
rm -f composer.json composer.lock package.json package-lock.json README.md
- name: Zip the plugin
run: |
zip -r sm-post-connector-package.zip . -x "*.git*" -x "*.github*" -x "*.yml" -x "phpunit.xml" -x "tests/**"
zip -r sm-post-connector-package.zip . -x "*.git*" -x "*.github*" -x "*.yml" -x "phpunit.xml" -x "tests/**" -x "docs/**"
- name: Create Release
id: create_release
uses: actions/create-release@v1 # Using the latest available stable version
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: SM Plugin v${{ env.VERSION }}
body: "Initial release of the SM Plugin plugin."
tag_name: ${{ env.VERSION }} # Use the validated version tag
release_name: SM Plugin ${{ env.VERSION }}
body: "Release of SM Post Connector plugin version ${{ env.VERSION }}."
draft: false
prerelease: false

Expand All @@ -56,4 +62,4 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sm-post-connector-package.zip
asset_name: sm-post-connector-package.zip
asset_content_type: application/zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion includes/Helper/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static function not_implemented($key = '') {
* @return WP_REST_Response The response object with a 500 status code.
*/
public static function error($key = '') {
$message = Globals::get_success_message('error');
$message = Globals::get_success_message($key);
return self::create_response(500, $message);
}
}

0 comments on commit c2d5f17

Please sign in to comment.