Skip to content

Commit

Permalink
ci/rework-include-ts (#34)
Browse files Browse the repository at this point in the history
* bump version 1.0.2-dev

* renamed package-ts

* Add Bump and tag script, release zenoh-ts on version tag include bump and tag script in main release

* fix syntax error

* remove release plugin, and fix release-ts

* change permissions ci bump script

* add publish to crates.io

* Add branch input, for dry run testing
  • Loading branch information
Charles-Schleich authored Nov 21, 2024
1 parent a90eb36 commit e13def4
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 95 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
workflow_dispatch:
push:
tags:
- [0-9]+.*

- '[0-9]+.*'

permissions:
contents: read
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/release-plugin.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
name: Package zenoh-ts
name: Release zenoh-ts

on:
workflow_dispatch:
inputs:
publish:
description: 'Publish artifacts'
default: false
required: false
type: boolean
version:
description: 'Library version'
required: false
default: '0.0.1'
type: string
zenoh_version:
description: 'Zenoh version'
required: true
type: string
default: '1.0.0-alpha.6'
push:
push:
tags:
- '[0-9]+.*'

defaults:
run:
Expand All @@ -28,8 +13,6 @@ defaults:
jobs:
package:
name: Package app for ${{ matrix.job.name }}
env:
NUXT_PUBLIC_VERSION: ${{ inputs.version }}
strategy:
fail-fast: false
runs-on: ubuntu-latest
Expand Down
54 changes: 44 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,33 @@ on:
jobs:
tag:
name: Branch, Bump & tag crates
uses: eclipse-zenoh/ci/.github/workflows/branch-bump-tag-crates.yml@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ inputs.version }}
branch: ${{ inputs.branch }}
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) || '' }}
secrets: inherit
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 }}
branch: ${{ inputs.branch }}
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:
LIVE_RUN: ${{ inputs.live_run }}
VERSION: ${{ steps.create-release-branch.outputs.version }}
BRANCH: ${{ inputs.branch }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: [email protected]

build-debian:
name: Build Debian packages
Expand All @@ -72,6 +89,23 @@ jobs:
^zenoh_plugin_remote_api(2)?\.dll$
secrets: inherit

cargo:
needs: tag
name: Publish Cargo crates
uses: eclipse-zenoh/ci/.github/workflows/release-crates-cargo.yml@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
branch: ${{ needs.tag.outputs.branch }}
# - In dry-run mode, we need to publish eclipse-zenoh/zenoh before this
# repository, in which case the version of zenoh dependecies are left as
# is and thus point to the main branch of eclipse-zenoh/zenoh.
# - In live-run mode, we assume that eclipse-zenoh/zenoh is already
# published as this workflow can't be responsible for publishing it
unpublished-deps-patterns: ${{ !(inputs.live-run || false) && 'zenoh.*' || '' }}
unpublished-deps-repos: ${{ !(inputs.live-run || false) && 'eclipse-zenoh/zenoh' || '' }}
secrets: inherit

debian:
name: Publish Debian packages
needs: [tag, build-debian]
Expand Down
50 changes: 50 additions & 0 deletions ci/scripts/bump-and-tag.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

set -xeo pipefail

readonly live_run=${LIVE_RUN:-false}
# Release number
readonly version=${VERSION:?input VERSION is required}
# Release number
readonly branch=${BRANCH:?input BRANCH is required}
# 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}

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

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"
}

package_json_path="./zenoh-ts/package.json"
plugin_toml_path="./zenoh-plugin-remote-api/Cargo.toml"
# Bump Cargo version of library and top level toml
toml_set_in_place ${plugin_toml_path} "package.version" "$version"
toml_set_in_place Cargo.toml "package.version" "$version"

# Bump package.json version
JQ=".version=\"$version\""
package_tmp=$(mktemp)
cat ${package_json_path} | jq "$JQ" > "$package_tmp"
mv ${package_tmp} ${package_json_path}

git commit Cargo.toml ${plugin_toml_path} ${package_json_path} -m "chore: Bump version to $version"
git push --force origin ${branch}

if [[ ${live_run} ]]; then
git tag --force "$version" -m "v$version"
git push --force origin "$version"
fi

git log -10
git show-ref --tags

0 comments on commit e13def4

Please sign in to comment.