-
-
Notifications
You must be signed in to change notification settings - Fork 86
132 lines (108 loc) · 4.67 KB
/
Copy pathbeta-release.yml
File metadata and controls
132 lines (108 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Beta Release
on:
push:
branches:
- main
- refactored-library
jobs:
beta-release:
name: Create Beta Release
runs-on: ubuntu-latest
# Skip if the commit was made by the bot (version bump commit)
if: "!contains(github.event.head_commit.message, '[skip ci]')"
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13.2"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Determine beta version
id: version
run: |
# Get current base version from manifest.json, stripping any existing beta suffix
BASE_VERSION=$(jq -r .version custom_components/mammotion/manifest.json | sed 's/-beta[0-9]*$//')
# Find the next available beta number by checking existing tags
BETA_NUM=1
while git tag --list "v${BASE_VERSION}-beta${BETA_NUM}" | grep -q .; do
BETA_NUM=$((BETA_NUM + 1))
done
BETA_VERSION="${BASE_VERSION}-beta${BETA_NUM}"
echo "beta_version=${BETA_VERSION}" >> $GITHUB_OUTPUT
echo "tag=v${BETA_VERSION}" >> $GITHUB_OUTPUT
echo "Next beta version: ${BETA_VERSION}"
- name: Update manifest.json
run: |
jq --arg version "${{ steps.version.outputs.beta_version }}" \
'.version = $version' custom_components/mammotion/manifest.json \
> /tmp/manifest.json
mv /tmp/manifest.json custom_components/mammotion/manifest.json
- name: Update pyproject.toml
run: |
sed -i 's/^version = ".*"/version = "${{ steps.version.outputs.beta_version }}"/' pyproject.toml
- name: Run poetry lock
run: poetry lock
- name: Commit and push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add custom_components/mammotion/manifest.json pyproject.toml poetry.lock
git commit -m "chore: bump version to ${{ steps.version.outputs.beta_version }} [skip ci]"
git push
- name: Create and push tag
run: |
git tag ${{ steps.version.outputs.tag }}
git push origin ${{ steps.version.outputs.tag }}
- name: Get previous release tag
id: previous_tag
run: |
previous=$(git tag --sort=-v:refname | grep -v "beta" | head -1)
if [ -z "$previous" ]; then
previous=$(git rev-list --max-parents=0 HEAD)
fi
echo "previous_tag=${previous}" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
run: |
{
echo 'changelog<<EOF'
git log --pretty=format:"- %h - %an: %s" \
"${{ steps.previous_tag.outputs.previous_tag }}".."${{ steps.version.outputs.tag }}" \
| grep -v "\[skip ci\]" || echo "- No user-facing changes"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create pre-release
uses: comnoco/create-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
release_name: Beta Release ${{ steps.version.outputs.tag }}
body: |
# Mammotion - Home Assistant Integration ${{ steps.version.outputs.tag }} (Beta)
[](https://discord.gg/vpZdWhJX8x)
> ⚠️ **This is a beta release.** To install via HACS, enable "Show beta versions" in your HACS settings.
## Changes since last stable release
${{ steps.changelog.outputs.changelog }}
## Installation via HACS
1. In HACS, go to **Settings** and enable **"Show beta versions"**.
2. Find the Mammotion integration and install the beta version.
3. Restart Home Assistant.
## Feedback and Support
If you encounter any issues, please:
- [Open an issue](https://github.com/${{ github.repository }}/issues) on GitHub
- [Join our Discord](https://discord.gg/vpZdWhJX8x) for community support
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.previous_tag.outputs.previous_tag }}...${{ steps.version.outputs.tag }}
draft: false
prerelease: true