Skip to content

Commit

Permalink
Fix Plugin Directory review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
balexey88 committed Apr 19, 2024
1 parent a79ab6f commit b382411
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,39 @@ on:
release:
description: 'Release version (e.g. 1.2.3)'
required: true
prerelease:
description: 'Pre-release version (e.g. RC1, beta, etc...)'
required: false

permissions:
contents: write

env:
TAG: ${{ github.event.inputs.release }}
PRETAG: ${{ github.event.inputs.prerelease }}
BRANCH: temp-release-${{ github.event.inputs.release }}

jobs:
build:
runs-on: ubuntu-latest
steps:
# ref and repository are required, otherwise repo could appear in detached head state
- name: Prepare vars
id: vars
uses: actions/github-script@v7
with:
script: |
const full_tag = [
process.env.TAG,
process.env.PRETAG
].filter(Boolean).join('-');
const branch = `temp-release-${full_tag}`;
const is_prerelease = !!process.env.PRETAG;
core.setOutput('full_tag', full_tag );
core.setOutput('branch', branch );
core.setOutput('is_prerelease', is_prerelease );
# 'ref' and 'repository' are required, otherwise repo could appear in detached head state
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -65,6 +85,7 @@ jobs:
run: |
rm -f composer.lock || true
rm -rf tests || true
rm -rf vendor/bin || true
rm -rf vendor/composer/installers || true
find ./ -name '.git*' -not -path './.git' -type f -delete || true
find ./ -name '.git*' -not -path './.git' -type d -exec rm -rf {} \; || true
Expand All @@ -83,8 +104,8 @@ jobs:
uses: EndBug/add-and-commit@v9
with:
message: Cleanup files for release
new_branch: ${{ env.BRANCH }}
tag: ${{ env.TAG }}
new_branch: ${{ steps.vars.outputs.branch }}
tag: ${{ steps.vars.outputs.full_tag }}

# generate SBOM that will be attached to a release as an artifact
- name: Create SBOM
Expand All @@ -98,13 +119,13 @@ jobs:
# create a draft release with the version changelog as a description
- name: Create Draft Release
id: draft_release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ env.TAG }}"
name: "Release ${{ steps.vars.outputs.full_tag }}"
body: "${{ steps.changelog.outputs.description }}"
tag_name: ${{ env.TAG }}
tag_name: ${{ steps.vars.outputs.full_tag }}
draft: true
prerelease: false
prerelease: ${{ steps.vars.outputs.is_prerelease }}

# attach SBOM to release
- name: Upload SBOM to release
Expand All @@ -128,4 +149,4 @@ jobs:
# delete temporary release branch
- name: Delete temporary release branch
run: |
git push origin --delete ${{ env.BRANCH }}
git push origin --delete ${{ steps.vars.outputs.branch }}
2 changes: 1 addition & 1 deletion wp-stateless-woocommerce-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

add_filter('plugin_row_meta', function ($plugin_meta, $plugin_file, $_, $__) {
if ($plugin_file !== join(DIRECTORY_SEPARATOR, [basename(__DIR__), basename(__FILE__)])) return $plugin_meta;
$plugin_meta[] = sprintf('<span style="color:red;">%s</span>', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.'));
$plugin_meta[] = sprintf('<span style="color:red;">%s</span>', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.', 'slcawc'));
return $plugin_meta;
}, 10, 4);
});

0 comments on commit b382411

Please sign in to comment.