154 lines
6.3 KiB
YAML
154 lines
6.3 KiB
YAML
name: Publish Beta Version
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
bump-version:
|
|
if: (github.actor == 'ronkelementor' || github.actor == 'KingYes') && startsWith(github.repository, 'elementor/')
|
|
runs-on: ubuntu-16.04
|
|
outputs:
|
|
prev_version: ${{ steps.bump_version_step.outputs.prev_version }}
|
|
steps:
|
|
- name: Checkout master branch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
token: ${{ secrets.MAINTAIN_TOKEN }}
|
|
ref: master
|
|
- name: Get release branch
|
|
run: |
|
|
bash "${GITHUB_WORKSPACE}/.github/scripts/get-release-branch-name.sh"
|
|
- name: Checkout next release branch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
token: ${{ secrets.MAINTAIN_TOKEN }}
|
|
ref: ${{ env.RELEASE_BRANCH }}
|
|
- name: Bump version
|
|
id: bump_version_step
|
|
run: |
|
|
npm install --no-package-lock --no-save semver@7.3.4
|
|
PREV_PACKAGE_VERSION=$(node -p "require('./package.json').last_beta_version")
|
|
NEW_PACKAGE_VERSION=$(node ./.github/scripts/update-prerelease-version.js beta)
|
|
PACKAGE_VERSION=$(node -p "require('./package.json').last_beta_version")
|
|
|
|
if [[ $PACKAGE_VERSION == *beta1 ]]
|
|
then
|
|
PREV_PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
fi
|
|
|
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
|
echo "::set-output name=prev_version::${PREV_PACKAGE_VERSION}"
|
|
- name: Push new version to beta version to release branch
|
|
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:
|
|
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: Get release branch
|
|
env:
|
|
INPUT_VERSION: ${{ github.event.inputs.version }}
|
|
run: |
|
|
bash "${GITHUB_WORKSPACE}/.github/scripts/get-release-branch-name.sh"
|
|
- name: Checkout next release branch
|
|
uses: actions/checkout@v2
|
|
with:
|
|
token: ${{ secrets.MAINTAIN_TOKEN }}
|
|
ref: ${{ env.RELEASE_BRANCH }}
|
|
- name: Install Dependencies
|
|
run: |
|
|
PACKAGE_VERSION=$(node -p "require('./package.json').last_beta_version")
|
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
|
npm ci
|
|
- name: Build
|
|
env:
|
|
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
|
|
run: |
|
|
bash "${GITHUB_WORKSPACE}/.github/scripts/add-to-readme-beta-tag.sh"
|
|
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"
|