mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-07-27 19:57:02 +00:00
.github/workflows: Convert python to npm semver style.
This commit is contained in:
@@ -10,7 +10,11 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Get version from tag
|
||||
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
|
||||
- name: Ubuntu packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -32,7 +36,7 @@ jobs:
|
||||
with:
|
||||
node-version: '22.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: npm version --no-git-tag-version "$VERSION"
|
||||
- run: npm version --no-git-tag-version "$NPM_VERSION"
|
||||
working-directory: npm/ide-docs
|
||||
- run: yarn build
|
||||
working-directory: npm/ide-docs
|
||||
|
||||
@@ -11,7 +11,11 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Get version from tag
|
||||
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "NPM_VERSION=$NPM_VERSION" >> $GITHUB_ENV
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
@@ -25,7 +29,7 @@ jobs:
|
||||
with:
|
||||
node-version: '22.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: ./build.py "$VERSION"
|
||||
- run: ./build.py "$NPM_VERSION"
|
||||
working-directory: npm/jedi
|
||||
- run: yarn publish
|
||||
working-directory: npm/jedi/build
|
||||
|
||||
+4
-2
@@ -9,7 +9,9 @@ source "$REPO_ROOT/.venv/bin/activate"
|
||||
|
||||
# Read version from pyproject.toml
|
||||
VERSION=$(grep '^version = ' "$REPO_ROOT/pyproject.toml" | head -1 | sed 's/version = "\(.*\)"/\1/')
|
||||
echo "==> Building version $VERSION"
|
||||
# Convert Python pre-release format (e.g. 4.0.0a1, 4.0.0b1, 4.0.0rc1) to npm semver (e.g. 4.0.0-alpha.1, 4.0.0-beta.1, 4.0.0-rc.1)
|
||||
NPM_VERSION=$(echo "$VERSION" | sed 's/\([0-9]\)a\([0-9]\)/\1-alpha.\2/;s/\([0-9]\)b\([0-9]\)/\1-beta.\2/;s/\([0-9]\)rc\([0-9]\)/\1-rc.\2/')
|
||||
echo "==> Building version $VERSION (npm: $NPM_VERSION)"
|
||||
|
||||
# lint
|
||||
echo "==> Linting"
|
||||
@@ -30,7 +32,7 @@ poetry build --format=wheel
|
||||
# @pybricks/jedi npm package
|
||||
echo "==> Building @pybricks/jedi"
|
||||
cd "$REPO_ROOT"
|
||||
python3 npm/jedi/build.py "$VERSION"
|
||||
python3 npm/jedi/build.py "$NPM_VERSION"
|
||||
|
||||
# @pybricks/ide-docs npm package
|
||||
echo "==> Building @pybricks/ide-docs"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks"
|
||||
version = "3.6.1"
|
||||
version = "4.0.0b1"
|
||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||
authors = ["The Pybricks Authors <team@pybricks.com>"]
|
||||
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
|
||||
|
||||
Reference in New Issue
Block a user