From b3824113590c38a27c674e8ae1661f7a7d2cd0c6 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 19 Apr 2024 23:04:28 +0300 Subject: [PATCH] Fix Plugin Directory review issues --- .github/workflows/publish-release.yml | 37 +++++++++++++++++++++------ wp-stateless-woocommerce-addon.php | 2 +- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 79d2df1..9ff0505 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 }} diff --git a/wp-stateless-woocommerce-addon.php b/wp-stateless-woocommerce-addon.php index a050890..6a5fce2 100644 --- a/wp-stateless-woocommerce-addon.php +++ b/wp-stateless-woocommerce-addon.php @@ -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('%s', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.')); + $plugin_meta[] = sprintf('%s', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.', 'slcawc')); return $plugin_meta; }, 10, 4); });