frappe_docker/.github/workflows/semantic-release.yml
2025-06-26 15:54:52 +02:00

64 lines
1.7 KiB
YAML

name: Semantic Release
on:
workflow_run:
workflows:
- Lint
types:
- completed
permissions:
actions: write
contents: write
issues: write
pull-requests: write
jobs:
release:
if: |
github.event_name == 'workflow_run' && 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 workflow metadata
uses: actions/upload-artifact@v4
with:
name: release-metadata
path: |
release_tag.txt
frappe_branch.txt