2
0
Fork 0
mirror of https://github.com/elementor/hello-theme.git synced 2026-03-05 14:52:51 +08:00
hello-theme/.github/workflows/publish-patch.yml
2025-08-05 14:32:57 +02:00

107 lines
3.8 KiB
YAML

name: Publish Patch Version
on:
workflow_dispatch:
jobs:
bump-version:
if: (github.actor == 'ronkelementor' || github.actor == 'KingYes') && startsWith(github.repository, 'elementor/')
runs-on: ubuntu-20.04
outputs:
prev_version: ${{ steps.bump_version_step.outputs.prev_version }}
steps:
- name: Checkout develop branch
uses: actions/checkout@v3
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: develop
- uses: actions/setup-node@v2
with:
node-version: '14'
- 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 version in files
env:
VERSION: ${{ env.PACKAGE_VERSION }}
run: |
npm install --no-package-lock --no-save replace-in-file@6.2.0
node ./.github/scripts/update-version-in-files.js
#npx grunt wp_readme
- 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/commit-push-bump.sh"
publish:
needs: bump-version
runs-on: ubuntu-20.04
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: main
- name: Merge develop -> main
uses: devmasx/merge-branch@a1752b9ba42bb417ec19be7dc974e2faf77d3ef2 # v1.3.1
with:
type: now
from_branch: develop
target_branch: main
github_token: ${{ secrets.MAINTAIN_TOKEN }}
- name: Checkout updated main branch
uses: actions/checkout@v2
with:
token: ${{ secrets.MAINTAIN_TOKEN }}
ref: main
- 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: npm run zip
- name: Upload zip file to GitHub actions artifact
uses: actions/upload-artifact@v2
with:
name: hello-elementor.${{ env.PACKAGE_VERSION }}
path: hello-elementor.*.zip
if-no-files-found: error
- name: Create tag
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }}
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }}
run: |
bash "${GITHUB_WORKSPACE}/.github/scripts/create-git-tag.sh"
- 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: hello-elementor.*.zip
body_path: temp-changelog-from-readme.txt
env:
GITHUB_TOKEN: ${{ secrets.MAINTAIN_TOKEN }}