Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/rework-include-ts #34

Merged
merged 9 commits into from
Nov 21, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/release-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Release
name: Release Plugin

permissions:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this whole workflow can be deleted. We have in the release.yml a job to publish the artifacts created during the build to github and release it as a Github release.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the workflow, i was under the impression the workflow was doing the releasing.

contents: write

on:
push:
tags:
- v[0-9]+.*
- 'v[0-9]+.*'

jobs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the v

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

create-release:
Expand Down
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:
- v[0-9]+.*

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the v and quoted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

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
36 changes: 26 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,32 @@ 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 }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: [email protected]

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

set -xeo pipefail

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

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

git log -10
git show-ref --tags
git push --force origin
git push --force origin "$version"
Loading