Skip to content

Flex Hero [TMZ-213] #181

Flex Hero [TMZ-213]

Flex Hero [TMZ-213] #181

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- master
workflow_call:
workflow_dispatch:
inputs:
push_to_slack:
description: 'Push to Slack'
type: boolean
required: true
default: 'false'
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0 # 2.27.1
with:
php-version: '7.4'
env:
fail-fast: 'true'
- name: OAuth Composer Authentication
run:
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install Composer dependencies cache
uses: ramsey/composer-install@v2
- name: Install Composer dependencies
run:
composer install --no-dev
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: "Debug info: show tooling versions"
continue-on-error: true
run: |
set +e
echo "Start debug Info"
echo "Date: ${{ steps.date.outputs.date }}"
echo "PHP Version: $(php -v)"
echo "Composer Version: $(composer --version)"
echo "Node Version: $(node --version)"
echo "NPM Version: $(npm --version)"
echo "GIT Version: $(git --version)"
echo "The github context is:"
echo "${{ toJson(github) }}"
echo "End debug Info"
echo "exitcode=$?" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
with:
registry-url: 'https://npm.pkg.github.com'
scope: '@elementor'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.CLOUD_DEVOPS_TOKEN }}
- name: Preparing envs
run: |
echo "PACKAGE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
echo "PLUGIN_SLUG=$(cat package.json | jq -r '.name')" >> $GITHUB_ENV
- name: Build Plugin dir
run: |
npm run package
- name: Archive
uses: actions/upload-artifact@v4
with:
name: ${{ env.PLUGIN_SLUG }}
path: ${{ env.PLUGIN_SLUG }}
retention-days: 14
- name: Push to Slack on PR merge
if: ${{ github.event.pull_request.merged == true }}
run: |
curl -F file=@${{ env.PLUGIN_SLUG }}.zip -F "initial_comment=Hello plus - A new PR has been pushed to the master branch by ${{ github.actor }}." title="${{ github.event.pull_request.title }}" -F channels=C081F86TPFS -H "Authorization: Bearer ${{ secrets.CLOUD_SLACK_BOT_TOKEN }}" https://slack.com/api/files.upload
- name: Push to Slack on Manual Trigger
if: ${{ github.event.inputs.push_to_slack == 'true' }}
run: |
curl -F file=@${{ env.PLUGIN_SLUG }}.zip -F "initial_comment=Hello plus - A new build was triggered by ${{ github.actor }}." title="Manuall ${{ steps.date.outputs.date }}" -F channels=C081F86TPFS -H "Authorization: Bearer ${{ secrets.CLOUD_SLACK_BOT_TOKEN }}" https://slack.com/api/files.upload