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

195 lines
7.7 KiB
YAML

name: Publish Release Version
on:
workflow_dispatch:
inputs:
canary:
description: 'Canary release (true/false)'
required: true
default: 'false'
version:
description: 'Release branch version'
required: false
jobs:
merge-release-branch-to-develop:
if: (github.actor == 'ronkelementor' || github.actor == 'KingYes') && startsWith(github.repository, 'elementor/')
runs-on: ubuntu-16.04
steps:
- name: Checkout master branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: master
- name: Get release branch
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/get-release-branch-name.sh"
- name: Checkout release branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: ${{ env.RELEASE_BRANCH }}
- name: Merge release -> develop
uses: devmasx/merge-branch@a1752b9ba42bb417ec19be7dc974e2faf77d3ef2 # v1.3.1
with:
type: now
from_branch: ${{ env.RELEASE_BRANCH }}
target_branch: develop
github_token: ${{ secrets.MAINTAIN_TOKEN }}
bump-version:
needs: merge-release-branch-to-develop
runs-on: ubuntu-16.04
outputs:
prev_version: ${{ steps.bump_version_step.outputs.prev_version }}
steps:
- name: Checkout develop branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: develop
- name: Bump version
id: bump_version_step
run: |
npm config set git-tag-version false
PREV_PACKAGE_VERSION=$(node -p "require('./package.json').version")
npm version minor
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
echo "::set-output name=prev_version::${PREV_PACKAGE_VERSION}"
- name: Update readme.txt file
if: github.event.inputs.canary != 'true'
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/remove-readme-beta-tag.sh"
bash "${GITHUB_WORKSPACE}/.github/scripts/update-readme-stable-version.sh"
- name: Check if readme.txt update
env:
VERSION: ${{ env.PACKAGE_VERSION }}
run: |
npm install --no-package-lock --no-save marked@2.0.6
node ./.github/scripts/get-changelog-from-readme-txt.js
- name: Push new version to develop
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }}
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/update-version-elementor-php.sh"
bash "${GITHUB_WORKSPACE}/.github/scripts/commit-push-bump.sh"
publish:
needs: bump-version
runs-on: ubuntu-16.04
steps:
- name: Checkout master branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: master
- name: Merge develop -> master
uses: devmasx/merge-branch@a1752b9ba42bb417ec19be7dc974e2faf77d3ef2 # v1.3.1
with:
type: now
from_branch: develop
target_branch: master
github_token: ${{ secrets.MAINTAIN_TOKEN }}
- name: Checkout updated master branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: master
- name: Install Dependencies
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
npm ci
- name: Build
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
run: |
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/**/*
- 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: Read changelog from readme.txt
env:
VERSION: ${{ env.PACKAGE_VERSION }}
run: |
npm install --no-package-lock --no-save marked@2.0.6
node ./.github/scripts/get-changelog-from-readme-txt.js
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.PACKAGE_VERSION }}
files: elementor-*.zip
body_path: temp-changelog-from-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: 'production'
- name: Trigger developer-edition release
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
event-type: new-release
- 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"