Template
61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
name: Update Version
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- dev
|
|
|
|
jobs:
|
|
update-version:
|
|
name: Update Version
|
|
runs-on: ubuntu-latest
|
|
if: github.actor != 'gitea-actions[bot]' && github.actor != 'Gitea Actions Bot'
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.PAT_TOKEN }}
|
|
|
|
- name: Determine integration name
|
|
id: integration_name
|
|
run: |
|
|
INTEGRATION_NAME=$(find custom_components -mindepth 1 -maxdepth 1 -type d -exec test -f {}/manifest.json \; -print -quit | xargs basename)
|
|
if [ -z "$INTEGRATION_NAME" ]; then
|
|
echo "Error: Integration directory not found in custom_components/"
|
|
exit 1
|
|
fi
|
|
echo "integration_name=$INTEGRATION_NAME" >> $GITHUB_OUTPUT
|
|
echo "Detected integration name: $INTEGRATION_NAME"
|
|
|
|
- name: Update pyproject.toml with integration name
|
|
run: |
|
|
sed -i "s|custom_components/INTEGRATION_NAME/manifest.json|custom_components/${{ steps.integration_name.outputs.integration_name }}/manifest.json|g" pyproject.toml
|
|
cat pyproject.toml | grep version_variables
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: pip install python-semantic-release
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --local user.email "actions@gitea.local"
|
|
git config --local user.name "Gitea Actions Bot"
|
|
|
|
- name: Run semantic-release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.PAT_TOKEN }}
|
|
run: |
|
|
unset GITHUB_SERVER_URL
|
|
unset GITHUB_API_URL
|
|
unset GITHUB_REPOSITORY
|
|
semantic-release version |