mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-23 16:25:09 +00:00
- Combined the `Pre-commit` and `Lint` workflows under the `on.workflow_run` trigger in the Semantic Release workflow. - Unified steps for dependency installation, testing, and release note generation. - Added handling for `FRAPPE_BRANCH` to ensure metadata files are created and uploaded consistently. - Reduced redundancy and improved maintainability of the workflow configuration.
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: Semantic Release
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows:
|
|
- Pre-commit
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
release:
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run tests
|
|
run: npm test
|
|
|
|
- name: Install conventional changelog
|
|
run: |
|
|
npm install --save-dev conventional-changelog-conventionalcommits
|
|
|
|
- name: Generate release notes and version
|
|
id: semantic_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
RELEASE_TAG=$(npx semantic-release | tee /dev/stderr | grep -oP '(?<=next release version is )[^ ]+')
|
|
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
|
|
|
|
- name: Create release metadata files
|
|
run: |
|
|
# Determine FRAPPE_BRANCH if not already set
|
|
FRAPPE_BRANCH=${{ vars.FRAPPE_BRANCH || 'version-15' }}
|
|
echo "FRAPPE_BRANCH=${FRAPPE_BRANCH}" >> $GITHUB_ENV
|
|
|
|
# Save metadata to files
|
|
echo "${RELEASE_TAG}" > release_tag.txt
|
|
echo "${FRAPPE_BRANCH}" > frappe_branch.txt
|
|
|
|
- name: Upload release metadata
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-metadata
|
|
path: |
|
|
release_tag.txt
|
|
frappe_branch.txt
|