Official release #43
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
# This workflow generates a PR for an official, manually triggered, release | |
name: Official release | |
on: | |
workflow_dispatch: # Manually on demand | |
inputs: | |
versionBump: | |
description: 'Type of version bump' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
skipChipTests: | |
description: 'Skip chip tests' | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
publish-config: | |
if: github.repository == 'project-chip/matter.js' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch the history, or this action won't work | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
- name: Prepare Webbrowser testing environment | |
uses: ./.github/actions/prepare-webtests | |
- name: Execute tests | |
run: npm run test | |
- name: Prepare chip tests | |
if: ${{ !inputs.skipChipTests }} | |
uses: ./.github/actions/prepare-chip-testing | |
with: | |
build-matter-js: "false" | |
- name: chip-tool-test execution | |
if: ${{ !inputs.skipChipTests }} | |
id: chip-test-execution | |
shell: bash | |
run: | | |
cd connectedhomeip | |
./scripts/run_in_build_env.sh \ | |
'./scripts/tests/run_test_suite.py \ | |
--runner chip_tool_python \ | |
--chip-tool ../bin/chip-tool \ | |
--log-level info \ | |
--target-glob "{Test_TC_ACE_*,Test_TC_ACL_*,Test_AddNewFabricFromExistingFabric,Test_TC_APBSC_*,Test_TC_BINFO_*,Test_TC_BOOL_*,Test_TC_BRBINFO_*,Test_TC_CADMIN_*,Test_TC_CGEN_*,Test_TC_CNET_*,Test_TC_DGGEN_*,Test_TC_DESC_*,Test_TC_FLABEL_*,Test_TC_FLW_*,Test_TC_I_*,Test_TC_LCFG_*,Test_TC_LOWPOWER_*,Test_TC_LTIME_*,Test_TC_LUNIT_*,Test_TC_MOD_*,Test_TC_OCC_*,Test_TC_OO_*,Test_TC_OPCREDS_*,Test_TC_PCC_*,Test_TC_PRS_*,Test_TC_PS_*,Test_TC_RH_*,Test_TC_SWTCH_*,Test_TC_TMP_*,Test_TC_TSUIC_*,Test_TC_ULABEL_*,Test_TC_WAKEONLAN_*,TestAccessControlC*,TestArmFailSafe,TestCASERecovery,TestCommandsById,TestCommissioningWindow,TestFabricRemovalWhileSubscribed,TestGeneralCommissioning,TestMultiAdmin,TestOperationalCredentialsCluster,TestSelfFabricRemoval,TestSubscribe_*,TestUserLabelCluster*,TestDiscovery}" \ | |
--target-skip-glob "{Test_TC_ACE_1_6,Test_TC_LVL_9_1,Test_TC_OO_2_7}" \ | |
run \ | |
--iterations 1 \ | |
--all-clusters-app ../chip-testing/dist/esm/AllClustersTestApp.js \ | |
--bridge-app ../chip-testing/dist/esm/BridgeTestApp.js \ | |
--tv-app ../chip-testing/dist/esm/TvTestApp.js \ | |
' | |
- name: Cleanup chip tests | |
if: ${{ !inputs.skipChipTests }} | |
id: cleanup-chip-tests | |
shell: bash | |
run: | | |
rm -rf connectedhomeip | |
- name: Determine the version bump | |
id: version | |
uses: actions/github-script@v7 | |
env: | |
VERSION_BUMP: ${{ inputs.versionBump }} | |
with: | |
result-encoding: string | |
script: | | |
const semver = require('semver'); | |
const prevVersion = require(`${process.env.GITHUB_WORKSPACE}/lerna.json`).version; | |
const parsed = semver.parse(prevVersion); | |
// Figure out the next version | |
return `${semver.inc(parsed, process.env.VERSION_BUMP)}`; | |
- name: Prepare changelog | |
env: | |
VERSION: ${{ steps.version.outputs.result }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const WIP_MARKER = '__WORK IN PROGRESS__'; | |
const TEMP_PLACEHOLDER = '**TEMP_PLACEHOLDER_GH_ACTION**'; | |
const changelog = fs | |
.readFileSync(`${process.env.GITHUB_WORKSPACE}/CHANGELOG.md`, 'utf8') | |
.replace(WIP_MARKER, TEMP_PLACEHOLDER); | |
if (!changelog.includes(WIP_MARKER)) { | |
throw new Error(`${WIP_MARKER} is missing in changelog`); | |
} | |
const dateStr = new Date().toISOString().split('T')[0]; | |
const versionDateStr = `${process.env.VERSION} (${dateStr})`; | |
fs.writeFileSync( | |
`${process.env.GITHUB_WORKSPACE}/CHANGELOG.md`, | |
changelog.replace(WIP_MARKER, versionDateStr).replace(TEMP_PLACEHOLDER, WIP_MARKER), | |
'utf8' | |
); | |
- name: Bump version locally | |
env: | |
VERSION: ${{ steps.version.outputs.result }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git add . | |
git commit -m "v${VERSION}" && npx lerna version ${VERSION} --no-push --exact --ignore-scripts --no-commit-hooks --yes --amend --force-publish || npx lerna version ${VERSION} --exact --no-push --ignore-scripts --no-commit-hooks --yes --force-publish | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.PR_TOKEN }} | |
commit-message: "[OFFICIAL RELEASE] ${{ steps.version.outputs.result }}" | |
committer: Automator77 <[email protected]> | |
author: Automator77 <[email protected]> | |
signoff: false | |
branch: official-release | |
delete-branch: true | |
title: "[OFFICIAL RELEASE] ${{ steps.version.outputs.result }}" | |
body: | | |
Update version by release action | |
labels: | | |
automated pr | |
assignees: Automator77 | |
draft: false |