feat: add hermes-meshtastic platform plugin and Gitea Actions release workflow
release / test-and-release (push) Successful in 1m5s
release / test-and-release (push) Successful in 1m5s
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
test-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install dependencies & build tool
|
||||
run: |
|
||||
pip install uv pytest
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
PYTHONPATH=plugin pytest plugin/tests
|
||||
|
||||
- name: Build wheel and sdist
|
||||
run: |
|
||||
uv build plugin/
|
||||
|
||||
- name: Publish Gitea Release (on tag or main)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tag_name="${GITHUB_REF#refs/tags/}"
|
||||
echo "Publishing release for $tag_name"
|
||||
# Upload via Gitea Release API if curl & jq present
|
||||
wheel_file=$(ls plugin/dist/*.whl | head -n 1)
|
||||
tar_file=$(ls plugin/dist/*.tar.gz | head -n 1)
|
||||
|
||||
# Create release
|
||||
response=$(curl -s -k -X POST "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"$tag_name\", \"name\": \"$tag_name\", \"body\": \"Release $tag_name for hermes-meshtastic plugin\"}")
|
||||
|
||||
release_id=$(echo "$response" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2)
|
||||
if [ -n "$release_id" ]; then
|
||||
curl -s -k -X POST "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$release_id/assets?name=$(basename $wheel_file)" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$wheel_file"
|
||||
curl -s -k -X POST "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$release_id/assets?name=$(basename $tar_file)" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$tar_file"
|
||||
fi
|
||||
Reference in New Issue
Block a user