name: Publish Patch Version on: workflow_dispatch: inputs: canary: description: 'Canary release (true/false)' required: true default: 'false' 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 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 patch 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/update-readme-stable-version.sh" - name: Get beta tag run: | npm install --no-package-lock --no-save semver@7.3.4 BETA_TAG=$(node ./.github/scripts/get-beta-version.js) echo "BETA_TAG=${BETA_TAG}" >> $GITHUB_ENV - name: Add beta tag if: ${{ env.BETA_TAG }} env: PACKAGE_VERSION: ${{ env.BETA_TAG }} run: | bash "${GITHUB_WORKSPACE}/.github/scripts/add-to-readme-beta-tag.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"