-
Notifications
You must be signed in to change notification settings - Fork 17.2k
94 lines (80 loc) · 2.98 KB
/
Copy pathrelease-plugin-python.yml
File metadata and controls
94 lines (80 loc) · 2.98 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
name: Release Python Plugin
on:
workflow_dispatch:
inputs:
tag:
description: "Semantic version for the plugin release (e.g. 1.0.0). The 'plugin-python-v' prefix is added automatically."
required: true
permissions:
contents: write
jobs:
validate:
name: Validate version
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.compute.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Validate version and compute tag
id: compute
env:
VERSION: ${{ github.event.inputs.tag }}
run: |
PREFIX="plugin-python-v"
# Back-compat: accept the full tag form (e.g. plugin-python-v1.0.4) too, not just
# the bare version. DO NOT REMOVE: old forks pass the full tag when releasing.
VERSION="${VERSION#"$PREFIX"}"
# Tolerate a bare "v" prefix (e.g. v1.0.4) so the tag isn't doubled below.
VERSION="${VERSION#v}"
# Validate via the shared script (same semver check as the auto-updater).
go run ./cmd/scripts/semver "$VERSION"
echo "tag=${PREFIX}${VERSION}" >> "$GITHUB_OUTPUT"
echo "Version '$VERSION' is valid. Release tag: ${PREFIX}${VERSION}"
release:
name: Build and Release Python Plugin
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Create distribution tarball
working-directory: plugin/python
run: |
mkdir -p release
# Create tarball with source code (venv is created on first run by pluginctl.sh)
# Note: pluginctl.sh is NOT included - it's copied separately by Dockerfile
# and we don't want old releases to overwrite newer pluginctl.sh versions
tar --exclude='*.pyc' \
--exclude='__pycache__' \
-czf release/python-plugin.tar.gz \
main.py \
contract/ \
pyproject.toml \
Makefile
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.validate.outputs.tag }}
name: "Python Plugin ${{ needs.validate.outputs.tag }}"
body: |
Python Plugin Release ${{ needs.validate.outputs.tag }}
## Requirements
- Python 3.9 or later
## Installation
1. Extract `python-plugin.tar.gz` to `plugin/python/`
2. The plugin will create a virtual environment on first run
## Assets
- `python-plugin.tar.gz` - Source code with pyproject.toml
files: |
plugin/python/release/python-plugin.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}