Files
carpseeds.pl/wp-content/plugins/elementor-3.2.5-bck4/.github/workflows/publish-developer-edition.yml
2024-07-15 11:28:08 +02:00

174 lines
7.5 KiB
YAML

name: Publish Developer Edition Version
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *' # run at 10 AM UTC
repository_dispatch:
types: [new-release]
jobs:
bump-version:
if: (github.event_name == 'schedule' || github.event_name == 'repository_dispatch' || github.actor == 'ronkelementor' || github.actor == 'KingYes') && startsWith(github.repository, 'elementor/')
runs-on: ubuntu-16.04
outputs:
cancel_workflow: ${{ steps.step_compare.outputs.cancel_workflow }}
prev_version: ${{ steps.bump_version_step.outputs.prev_version }}
steps:
- name: Check developer-edition GitHub checks
uses: ronkelementor/confirm-checks-action@f1f421685b34aaf0b1933b47cc9344c3a35307d6 # main
with:
github_token: ${{ secrets.MAINTAIN_TOKEN }}
commit: developer-edition
checks: 'JS-Lint,PHP-Lint,Qunit,Lighthouse test - WP latest on PHP 7.4'
- name: Checkout master branch
if: github.event_name == 'repository_dispatch' && github.event.action == 'new-release'
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: master
- name: Sync developer-edition branch
if: github.event_name == 'repository_dispatch' && github.event.action == 'new-release'
env:
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }}
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/sync-developer-edition-branch.sh"
- name: Checkout developer-edition branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: developer-edition
- name: Compare last tag to developer-edition head
id: step_compare
if: github.event_name != 'repository_dispatch'
shell: bash +e {0}
env:
TOKEN: ${{ secrets.MAINTAIN_TOKEN }}
REPOSITORY: ${{ github.repository }}
HEAD_BRANCH_NAME: developer-edition
run: |
npm install --no-package-lock --no-save @octokit/core@3.4.0
LAST_DEV_TAG_NAME=$(node -p "require('./package.json').last_dev_version")
export BASE_TAG_NAME="v${LAST_DEV_TAG_NAME}"
node ./.github/scripts/compare-tag-to-branch.js
if [ $? -eq 0 ]; then
echo "::set-output name=cancel_workflow::1"
echo "CANCEL_WORKFLOW=1" >> $GITHUB_ENV
fi
- name: Bump version
id: bump_version_step
if: ${{ !env.CANCEL_WORKFLOW }}
run: |
npm install --no-package-lock --no-save semver@7.3.4
PREV_PACKAGE_VERSION=$(node -p "require('./package.json').last_dev_version")
NEW_PACKAGE_VERSION=$(node ./.github/scripts/update-prerelease-version.js dev)
PACKAGE_VERSION=$(node -p "require('./package.json').last_dev_version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
echo "::set-output name=prev_version::${PREV_PACKAGE_VERSION}"
- name: Push new version to developer-edition
if: ${{ !env.CANCEL_WORKFLOW }}
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }}
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/commit-push-bump.sh"
publish:
if: ${{ !needs.bump-version.outputs.cancel_workflow }}
needs: bump-version
runs-on: ubuntu-16.04
steps:
- name: Checkout developer-edition branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: developer-edition
- name: Install Dependencies
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').last_dev_version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
npm ci
- name: Build
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/update-version-elementor-php.sh"
bash "${GITHUB_WORKSPACE}/.github/scripts/build-zip.sh"
- name: Publish to WordPress.org SVN
env:
PLUGIN_VERSION: ${{ env.PACKAGE_VERSION }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/publish-to-wordpress-org.sh"
- name: Upload zip file to GitHub actions artifact
uses: actions/upload-artifact@v2
with:
name: elementor-${{ env.PACKAGE_VERSION }}
path: ${{ github.workspace }}/elementor/**/*
if-no-files-found: error
- name: Create tag
env:
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }}
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/create-git-tag.sh"
- name: Generate changelog
env:
TOKEN: ${{ secrets.MAINTAIN_TOKEN }}
REPOSITORY: ${{ github.repository }}
HEAD_BRANCH_NAME: v${{ env.PACKAGE_VERSION }}
BASE_TAG_NAME: v${{ needs.bump-version.outputs.prev_version }}
run: |
npm install --no-package-lock --no-save @octokit/core@3.4.0
node ./.github/scripts/generate-changelog.js
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.PACKAGE_VERSION }}
files: elementor-*.zip
prerelease: true
body_path: temp-changelog.txt
env:
GITHUB_TOKEN: ${{ secrets.MAINTAIN_TOKEN }}
- name: Read changelog and set current date
run: |
CHANGELOG=$(cat temp-changelog.txt | tr -d '\n')
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "CHANGELOG=${CHANGELOG}" >> $GITHUB_ENV
echo "NOW=${NOW}" >> $GITHUB_ENV
- name: Parse Jira Keys from changelog
id: jira_keys
uses: HighwayThree/jira-extract-issue-keys@8050830121f3eab19553d2f0c0150873a8d1b51b
with:
commit-message: '${{ env.CHANGELOG }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Deployment Info to Jira
if: steps.jira_keys.outputs.jira-keys != ''
uses: HighwayThree/jira-upload-deployment-info@7cd4db1e5cc96692fd0b4c688407efd95ae3e610
with:
client-id: '${{ secrets.JIRA_CLIENT_ID }}'
client-secret: '${{ secrets.JIRA_CLIENT_SECRET }}'
cloud-instance-base-url: '${{ secrets.JIRA_CLOUD_INSTANCE_BASE_URL }}'
issue-keys: "${{ steps.jira_keys.outputs.jira-keys }}"
display-name: "${{ env.PACKAGE_VERSION }}"
url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
description: "This PR was merged to the following release(s)"
last-updated: '${{ env.NOW }}'
state: 'successful'
pipeline-id: '${{ github.repository }} ${{ github.workflow }}'
pipeline-url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
environment-id: "${{ env.PACKAGE_VERSION }}"
environment-display-name: "${{ env.PACKAGE_VERSION }}"
environment-type: 'staging'
- name: Notify Slack
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
SLACK_CHANNELS: ${{ secrets.SLACK_CHANNELS }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/slack-notify.sh"