-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: Get Read the Docs release number from Cargo manifest This avoids hardcoding the release number in the documentation build config, making it easier to bump the version by only modifying the manifest. * build: Require Python 3.11 in Read the Docs configuration Python 3.11 is needed to access tomllib; useful for parsing the Cargo manifest file. * feat: Create branch, bump version and tag in release workflow * feat: Add publish-github job * fix: Broken tag dependencies * chore: Remove enforce-linking-issues workflow * fix: Bump version in pyproject.toml * chore: Upgrade artifact actions from v3 to v4 * fix: Typo in git-commit command * fix: Support jq 1.6 ubuntu-22.04 runners use jq 1.6 which doesn't recognize a dot for `[]` value iterator. See: jqlang/jq#1168. * Revert "chore: Upgrade artifact actions from v3 to v4" This reverts commit a535971. * fix: Build wheels from release branch * fix: Switch to pypa/gh-action-pypi-publish@release/v1 The older actions doesn't recognize the pyproject.toml metadata fields.
- Loading branch information
1 parent
b70096e
commit 7443623
Showing
5 changed files
with
173 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,62 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
schedule: | ||
- cron: "0 1 * * 1-5" | ||
workflow_dispatch: | ||
inputs: | ||
live-run: | ||
type: boolean | ||
description: Live-run | ||
required: false | ||
version: | ||
type: string | ||
description: Release number | ||
required: false | ||
zenoh-version: | ||
type: string | ||
description: Release number of Zenoh | ||
required: false | ||
|
||
jobs: | ||
macos: | ||
tag: | ||
name: Branch, Bump & tag | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.create-release-branch.outputs.version }} | ||
branch: ${{ steps.create-release-branch.outputs.branch }} | ||
steps: | ||
- id: create-release-branch | ||
uses: eclipse-zenoh/ci/create-release-branch@main | ||
with: | ||
repo: ${{ github.repository }} | ||
live-run: ${{ inputs.live-run || false }} | ||
version: ${{ inputs.version }} | ||
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} | ||
|
||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.create-release-branch.outputs.branch }} | ||
|
||
- name: Bump and tag project | ||
run: bash ci/scripts/bump-and-tag.bash | ||
env: | ||
VERSION: ${{ steps.create-release-branch.outputs.version }} | ||
BUMP_DEPS_VERSION: ${{ inputs.zenoh-version }} | ||
BUMP_DEPS_PATTERN: ${{ inputs.zenoh-version && 'zenoh.*' || '' }} | ||
BUMP_DEPS_BRANCH: ${{ inputs.zenoh-version && format('release/{0}', inputs.zenoh-version) || '' }} | ||
GIT_USER_NAME: eclipse-zenoh-bot | ||
GIT_USER_EMAIL: [email protected] | ||
|
||
build-macos: | ||
needs: tag | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
|
||
- name: Install Rust toolchain | ||
run: | | ||
|
@@ -36,7 +80,8 @@ jobs: | |
name: wheels | ||
path: dist | ||
|
||
windows: | ||
build-windows: | ||
needs: tag | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
|
@@ -45,6 +90,8 @@ jobs: | |
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
|
||
- name: Install Rust toolchain | ||
run: | | ||
|
@@ -63,14 +110,17 @@ jobs: | |
name: wheels | ||
path: dist | ||
|
||
linux: | ||
build-linux: | ||
needs: tag | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: [x86_64, i686, armv7] | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
|
||
- name: Build wheels | ||
uses: messense/maturin-action@v1 | ||
|
@@ -85,11 +135,14 @@ jobs: | |
name: wheels | ||
path: dist | ||
|
||
linux-aarch64: | ||
build-linux-aarch64: | ||
needs: tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
|
||
- name: Build wheels | ||
uses: messense/maturin-action@v1 | ||
|
@@ -110,18 +163,21 @@ jobs: | |
name: wheels | ||
path: dist | ||
|
||
linux-armv6: | ||
build-linux-armv6: | ||
needs: tag | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
|
||
- name: Install Rust toolchain | ||
run: | | ||
rustup set profile minimal | ||
rustup target add arm-unknown-linux-gnueabihf | ||
- name: install cross toolchain | ||
- name: Install cross toolchain | ||
run: | | ||
brew tap messense/macos-cross-toolchains | ||
brew install arm-unknown-linux-gnueabihf | ||
|
@@ -140,19 +196,50 @@ jobs: | |
name: wheels | ||
path: dist | ||
|
||
deploy-wheels: | ||
needs: [macos, windows, linux, linux-armv6] | ||
name: deploy wheels to pypi | ||
publish-pypi: | ||
needs: | ||
[ | ||
tag, | ||
build-macos, | ||
build-windows, | ||
build-linux, | ||
build-linux-armv6, | ||
build-linux-aarch64, | ||
] | ||
name: Deploy wheels to pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
- name: Check dist | ||
run: ls -al ./dist/* | ||
- name: publish | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
uses: pypa/[email protected] | ||
|
||
- name: Publish | ||
if: ${{ inputs.live-run || false }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_ORG_TOKEN }} | ||
|
||
publish-github: | ||
needs: | ||
[ | ||
tag, | ||
build-macos, | ||
build-windows, | ||
build-linux, | ||
build-linux-armv6, | ||
build-linux-aarch64, | ||
] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: eclipse-zenoh/ci/publish-crates-github@main | ||
with: | ||
repo: ${{ github.repository }} | ||
live-run: ${{ inputs.live-run || false }} | ||
version: ${{ needs.tag.outputs.version }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }} | ||
archive-patterns: "^$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ sphinx: | |
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.8" | ||
python: "3.11" | ||
rust: "latest" | ||
jobs: | ||
pre_build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xeo pipefail | ||
|
||
# Release number | ||
readonly version=${VERSION:?input VERSION is required} | ||
# Dependencies' pattern | ||
readonly bump_deps_pattern=${BUMP_DEPS_PATTERN:-''} | ||
# Dependencies' version | ||
readonly bump_deps_version=${BUMP_DEPS_VERSION:-''} | ||
# Dependencies' git branch | ||
readonly bump_deps_branch=${BUMP_DEPS_BRANCH:-''} | ||
# Git actor name | ||
readonly git_user_name=${GIT_USER_NAME:?input GIT_USER_NAME is required} | ||
# Git actor email | ||
readonly git_user_email=${GIT_USER_EMAIL:?input GIT_USER_EMAIL is required} | ||
|
||
cargo +stable install toml-cli | ||
|
||
# NOTE(fuzzypixelz): toml-cli doesn't yet support in-place modification | ||
# See: https://github.com/gnprice/toml-cli?tab=readme-ov-file#writing-ish-toml-set | ||
function toml_set_in_place() { | ||
local tmp=$(mktemp) | ||
toml set "$1" "$2" "$3" > "$tmp" | ||
mv "$tmp" "$1" | ||
} | ||
|
||
export GIT_AUTHOR_NAME=$git_user_name | ||
export GIT_AUTHOR_EMAIL=$git_user_email | ||
export GIT_COMMITTER_NAME=$git_user_name | ||
export GIT_COMMITTER_EMAIL=$git_user_email | ||
|
||
# Bump Cargo version | ||
toml_set_in_place Cargo.toml "package.version" "$version" | ||
# Propagate version change to pyproject.toml | ||
toml_set_in_place pyproject.toml "project.version" "$version" | ||
|
||
git commit Cargo.toml pyproject.toml -m "chore: Bump version to $version" | ||
|
||
# Select all package dependencies that match $bump_deps_pattern and bump them to $bump_deps_version | ||
if [[ "$bump_deps_pattern" != '' ]]; then | ||
deps=$(toml get Cargo.toml dependencies | jq -r "keys[] | select(test(\"$bump_deps_pattern\"))") | ||
for dep in $deps; do | ||
if [[ -n $bump_deps_version ]]; then | ||
toml_set_in_place Cargo.toml "dependencies.$dep.version" "$bump_deps_version" | ||
fi | ||
|
||
if [[ -n $bump_deps_branch ]]; then | ||
toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$bump_deps_branch" | ||
fi | ||
done | ||
# Update lockfile | ||
cargo check | ||
|
||
if [[ -n $bump_deps_version || -n $bump_deps_branch ]]; then | ||
git commit Cargo.toml Cargo.lock -m "chore: Bump $bump_deps_pattern version to $bump_deps_version" | ||
else | ||
echo "warn: no changes have been made to any dependencies matching $bump_deps_pattern" | ||
fi | ||
fi | ||
|
||
git tag --force "$version" -m "v$version" | ||
git log -10 | ||
git show-ref --tags | ||
git push origin | ||
git push --force origin "$version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
|
||
# -- Project setup -------------------------------------------------------------- | ||
|
||
import tomllib | ||
|
||
import zenoh | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
@@ -31,8 +33,9 @@ | |
copyright = '2020, ZettaScale Zenoh team, <[email protected]>' | ||
author = 'ZettaScale Zenoh team, <[email protected]>' | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = '0.11.0-dev' | ||
# Extract the release number from the Cargo manifest | ||
with open("../Cargo.toml", "rb") as f: | ||
release = tomllib.load(f)["package"]["version"] | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|