Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
94be548
feat: declare workflow outputs from job outputs
Biont Feb 28, 2024
e100109
Update to actions/upload-artifact@v4
Biont Feb 28, 2024
5a6722b
Split into three jobs.
Biont Mar 19, 2024
fe7f453
Set up job dependencies
Biont Mar 19, 2024
852ecfd
Fix upload directory
Biont Mar 19, 2024
a6ed282
Test for build tool configs
Biont Mar 19, 2024
77b17d8
Improve artifact naming
Biont Mar 19, 2024
134d063
Allow composer plugins prior to installation
Biont Mar 19, 2024
9a55296
Allow composer plugins prior to installation
Biont Mar 19, 2024
b69e951
Allow composer plugins prior to installation
Biont Mar 19, 2024
d16d060
Set up php for wp-cli
Biont Mar 19, 2024
102504a
remove some clutter from deps artifact already
Biont Mar 19, 2024
1078279
improve artifact naming
Biont Mar 19, 2024
5c8b9fa
Move required data for final archive step
Biont Mar 19, 2024
520353b
Add missing path config for final artifact upload
Biont Mar 19, 2024
c615353
Move env vars where they belong
Biont Mar 19, 2024
741d772
Merge branch 'main' into feature/multi-step-plugin-archive
Biont Mar 19, 2024
607a5e2
Move PLUGIN_FOLDER_NAME as well
Biont Mar 20, 2024
2451d0e
Update .github/workflows/build-plugin-archive.yml
Biont Mar 21, 2024
8839d57
Update .github/workflows/build-plugin-archive.yml
Biont Mar 21, 2024
251fea6
Update .github/workflows/build-plugin-archive.yml
Biont Mar 21, 2024
058508e
Introduce PHP_VERSION_BUILD
Biont Mar 21, 2024
c59e12e
Remove somewhat redundant check for package.json files
Biont Mar 21, 2024
69f6a84
Update docs/archive-creation.md
Biont Mar 21, 2024
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
41 changes: 14 additions & 27 deletions .github/workflows/build-plugin-archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ on:
required: false
type: string
COMPOSER_ARGS:
description: Set of arguments passed to Composer.
description: Set of arguments passed to Composer when gathering production dependencies.
default: '--no-dev --prefer-dist --optimize-autoloader'
required: false
type: string
PHP_VERSION:
description: PHP version to use during packaging.
description: PHP version to use when gathering production dependencies.
default: "8.0"
required: false
type: string
PHP_VERSION_BUILD:
description: PHP version to use when executing build tools.
default: "8.0"
required: false
type: string
Expand Down Expand Up @@ -163,11 +168,6 @@ jobs:
local EXIT=$?
echo "$EXIT"
}
hasDep(){
composer show -i -N -D --strict "${1}" >/dev/null 2>&1
local EXIT=$?
echo "$EXIT"
}
echo "assets-compiler=$( hasAssetConfig )" >> $GITHUB_OUTPUT
echo "translation-downloader=$( hasTranslateConfig )" >> $GITHUB_OUTPUT

Expand All @@ -181,41 +181,28 @@ jobs:
echo "No lock files found or unknown package manager"
fi

- name: Check for package.json
id: check-for-package
run: |
if [ -f package.json ]; then
echo "has_package=true" >> $GITHUB_OUTPUT
else
echo "has_package=false" >> $GITHUB_OUTPUT
fi

- name: Set up node
if: steps.check-for-package.outputs.has_package == 'true'
if: steps.composer-tools.outputs.assets-compiler == '0'
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.NODE_VERSION }}
registry-url: ${{ inputs.NPM_REGISTRY_DOMAIN }}
cache: ${{ env.NODE_CACHE_MODE }}

- name: Install Composer Asset Compiler
if: steps.composer-tools.outputs.assets-compiler == '0' && steps.check-for-package.outputs.has_package == 'true'
- name: Install and run Composer Asset Compiler
if: steps.composer-tools.outputs.assets-compiler == '0'
run: |
composer global config --no-plugins --no-interaction allow-plugins.inpsyde/composer-assets-compiler true
composer global require inpsyde/composer-assets-compiler
- name: Run Composer Asset Compiler
if: steps.composer-tools.outputs.assets-compiler == '0' && steps.check-for-package.outputs.has_package == 'true'
run: composer compile-assets ${{ inputs.COMPILE_ASSETS_ARGS }}
composer compile-assets ${{ inputs.COMPILE_ASSETS_ARGS }}

- name: Install WordPress Translation Downloader
- name: Install and run WordPress Translation Downloader
if: steps.composer-tools.outputs.translation-downloader == '0'
run: |
composer global config --no-plugins --no-interaction allow-plugins.composer/installers true
composer global config --no-plugins --no-interaction allow-plugins.inpsyde/wp-translation-downloader true
composer global require inpsyde/wp-translation-downloader
- name: Run WordPress Translation Downloader
if: steps.composer-tools.outputs.translation-downloader == '0'
run: composer wp-translation-downloader:download
composer wp-translation-downloader:download

- name: Set artifact name
id: set-artifact-name
Expand Down Expand Up @@ -260,7 +247,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: ${{ inputs.PHP_VERSION_BUILD }}
tools: wp-cli

- name: Install dist-archive command
Expand Down
3 changes: 2 additions & 1 deletion docs/archive-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
| `NPM_REGISTRY_DOMAIN` | `"https://npm.pkg.github.com/"` | Domain of the private npm registry |
| `PACKAGE_MANAGER` | `"yarn"` | Package manager with which the dependencies should be installed (`npm` or `yarn`) |
| `COMPOSER_ARGS` | `'--no-dev --no-scripts --prefer-dist --optimize-autoloader'` | Set of arguments passed to Composer |
| `PHP_VERSION` | `"8.0"` | PHP version to use during packaging |
| `PHP_VERSION` | `"8.0"` | PHP version to use when gathering production dependencies |
| `PHP_VERSION_BUILD` | `"8.0"` | PHP version to use when executing build tools |
| `ARCHIVE_NAME` | `""` | The name of the zip archive (falls back to the repository name) |
| `PLUGIN_MAIN_FILE` | `"index.php"` | The name of the main plugin file |
| `PLUGIN_FOLDER_NAME` | `""` | The name of the plugin folder (falls back to the archive name, if set, or the repository name) |
Expand Down