d3e0ca4e33
Agent-Logs-Url: https://github.com/christianlouis/InboxConverge/sessions/36c964fc-1fc5-4b0a-b223-43a033f7b26b Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: Semantic Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
packages: write
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
|
|
jobs:
|
|
release:
|
|
name: Semantic Release
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'christianlouis/InboxConverge'
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install python-semantic-release
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Run Semantic Release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
semantic-release version --print
|
|
semantic-release version
|
|
semantic-release publish
|
|
|
|
- name: Update changelog if no new version was released
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
# Detect whether `semantic-release version` just created a version commit.
|
|
# PSR's version commits have a bare version number as the subject (e.g. "0.2.2").
|
|
# If the latest commit matches that pattern the changelog was already updated.
|
|
LAST_COMMIT_MSG=$(git log -1 --format="%s")
|
|
if echo "$LAST_COMMIT_MSG" | grep -qP "^\d+\.\d+\.\d+$"; then
|
|
echo "semantic-release created version commit '$LAST_COMMIT_MSG' - CHANGELOG.md already updated"
|
|
else
|
|
echo "No new version was released; CHANGELOG.md unchanged"
|
|
fi
|