Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responses update and deployment #25

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading