Internal: Revert cover #178
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
workflow_call: | |
outputs: | |
artifact_name: | |
value: ${{ jobs.build-plugin.outputs.artifact_name }} | |
changelog_diff: | |
value: ${{ jobs.build-plugin.outputs.changelog_diff }} | |
push: | |
branches: | |
- 'main' | |
- '3.*' | |
jobs: | |
build-plugin: | |
name: Build plugin | |
runs-on: ubuntu-22.04 | |
if: startsWith( github.repository, 'elementor/' ) | |
outputs: | |
artifact_name: ${{ env.PLUGIN_FOLDER_FILENAME}} | |
changelog_diff: ${{ steps.changelog_diff_files.outputs.diff }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Install Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- name: Check if this is only a changelog PR | |
id: changelog_diff_files | |
uses: technote-space/get-diff-action@v6 | |
with: | |
# PATTERNS are: | |
# Everything: **/* | |
# Everything in directories starting with a period: .*/**/* | |
# Not readme.txt: !readme.txt | |
# Not changelog.txt: !changelog.txt | |
PATTERNS: | | |
**/* | |
.*/**/* | |
!readme.txt | |
!changelog.txt | |
- name: Prevent git tag versioning | |
shell: bash | |
run: npm config set git-tag-version false | |
- name: Install Dependencies | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
uses: ./.github/workflows/install-dependencies | |
- name: Set ENV variables | |
shell: bash | |
run: | | |
DATE_VERSION=$(date '+%Y%m%d.%H%M') | |
VERSION=$(cat package.json \ | |
| grep version \ | |
| head -1 \ | |
| awk -F: '{ print $2 }' \ | |
| sed 's/[",]//g' \ | |
| tr -d '[[:space:]]') | |
PACKAGE_VERSION=${VERSION}-${DATE_VERSION} | |
PLUGIN_FOLDER_FILENAME="elementor-${PACKAGE_VERSION}" | |
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
echo "PLUGIN_FOLDER_FILENAME=$PLUGIN_FOLDER_FILENAME" >> $GITHUB_ENV | |
- name: Build plugin | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
uses: ./.github/workflows/build-plugin | |
with: | |
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }} | |
BUILD_SCRIPT_PATH: "./.github/scripts/build-zip.sh" | |
- uses: actions/upload-artifact@v4 | |
if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff | |
with: | |
name: ${{ env.PLUGIN_FOLDER_FILENAME }} | |
path: elementor |