mirror of
https://github.com/home-assistant/operating-system
synced 2024-10-30 12:56:40 +01:00
Adjust Home Assistant OS versioning to prepare for new release strategy (#2767)
* Adjust Home Assistant versioning to prepare for new release strategy With OS 11 we'll create rc pre-releases which will get directly pushed to the beta channel. In contrast, release builds will get directly pushed to the stable channel. Similar to Home Assistant Core we'll create bump commits for all stable and beta releases. This makes sure that the source code matches the built binaries for all releases. The development build will get a generated version. To avoid issues with the new rc builds the dev build version will get injected on source level now. * Apply suggestions from code review
This commit is contained in:
parent
7870a1d78e
commit
3df2749171
72
.github/workflows/build.yaml
vendored
72
.github/workflows/build.yaml
vendored
@ -21,8 +21,9 @@ jobs:
|
|||||||
pull-requests: read
|
pull-requests: read
|
||||||
packages: write
|
packages: write
|
||||||
outputs:
|
outputs:
|
||||||
version_main: ${{ steps.version_main.outputs.version_main }}
|
|
||||||
version_dev: ${{ steps.version_dev.outputs.version_dev }}
|
version_dev: ${{ steps.version_dev.outputs.version_dev }}
|
||||||
|
version_main: ${{ steps.version.outputs.version_main }}
|
||||||
|
version_full: ${{ steps.version.outputs.version_full }}
|
||||||
channel: ${{ steps.channel.outputs.channel }}
|
channel: ${{ steps.channel.outputs.channel }}
|
||||||
matrix: ${{ steps.generate_matrix.outputs.result }}
|
matrix: ${{ steps.generate_matrix.outputs.result }}
|
||||||
build_container_image: ghcr.io/${{ github.repository_owner }}/haos-builder@${{ steps.build_haos_builder.outputs.digest }}
|
build_container_image: ghcr.io/${{ github.repository_owner }}/haos-builder@${{ steps.build_haos_builder.outputs.digest }}
|
||||||
@ -32,32 +33,49 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Generate development version
|
||||||
|
shell: bash
|
||||||
|
id: version_dev
|
||||||
|
if: ${{ github.event_name != 'release' }}
|
||||||
|
run: |
|
||||||
|
version_dev="dev$(date --utc +'%Y%m%d')"
|
||||||
|
echo "Development version \"${version_dev}\""
|
||||||
|
echo "version_dev=${version_dev}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Set version suffix
|
||||||
|
if: ${{ github.event_name != 'release' }}
|
||||||
|
env:
|
||||||
|
VERSION_DEV: ${{ steps.version_dev.outputs.version_dev }}
|
||||||
|
run: |
|
||||||
|
sed -E "s/(^VERSION_SUFFIX=\").*(\"$)/\1${VERSION_DEV}\2/" buildroot-external/meta
|
||||||
|
|
||||||
- name: Validate version
|
- name: Validate version
|
||||||
id: version_check
|
id: version_check
|
||||||
if: ${{ github.event_name == 'release' }}
|
if: ${{ github.event_name == 'release' }}
|
||||||
run: |
|
run: |
|
||||||
major=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MAJOR | cut -d'=' -f2)
|
major=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MAJOR | cut -d'=' -f2)
|
||||||
build=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_BUILD | cut -d'=' -f2)
|
minor=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MINOR | cut -d'=' -f2)
|
||||||
|
suffix=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_SUFFIX | cut -d'=' -f2)
|
||||||
tag_major=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 1)
|
tag_major=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 1)
|
||||||
tag_build=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 2)
|
tag_minor=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 2)
|
||||||
tag_dev=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 3)
|
tag_suffix=$(echo "${{ github.event.release.tag_name }}" | cut -d '.' -f 3)
|
||||||
if [ "${major}.${build}" != "${tag_major}.${tag_build}" ]; then
|
if [ "${major}.${minor}.${suffix}" != "${tag_major}.${tag_minor}.${tag_suffix}" ]; then
|
||||||
echo "Version number in Buildroot metadata is does not match tag (${major}.${build} vs ${{ github.event.release.tag_name }})."
|
echo "Version number in Buildroot metadata does not match tag (${major}.${minor}.${suffix} vs ${{ github.event.release.tag_name }})."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "" != "${tag_dev}" ]; then
|
|
||||||
echo "version=${major}.${build}.${tag_dev}" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "version=${major}.${build}" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
echo "version_dev=${tag_dev}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Get Major/Minor version
|
- name: Get version
|
||||||
id: version_main
|
id: version
|
||||||
run: |
|
run: |
|
||||||
major=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MAJOR | cut -d'=' -f2)
|
major=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MAJOR | cut -d'=' -f2)
|
||||||
build=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_BUILD | cut -d'=' -f2)
|
minor=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_MINOR | cut -d'=' -f2)
|
||||||
echo "version_main=${major}.${build}" >> $GITHUB_OUTPUT
|
suffix=$(cat ${GITHUB_WORKSPACE}/buildroot-external/meta | grep VERSION_SUFFIX | cut -d'=' -f2)
|
||||||
|
echo "version_main=${major}.${minor}" >> $GITHUB_OUTPUT
|
||||||
|
if [ -z "${suffix}" ]; then
|
||||||
|
echo "version_full=${major}.${minor}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "version_full=${major}.${minor}.${suffix}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Get channel
|
- name: Get channel
|
||||||
id: channel
|
id: channel
|
||||||
@ -72,15 +90,6 @@ jobs:
|
|||||||
echo "channel=dev" >> "$GITHUB_OUTPUT"
|
echo "channel=dev" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Generate Development build version
|
|
||||||
shell: bash
|
|
||||||
id: version_dev
|
|
||||||
if: ${{ github.event_name != 'release' }}
|
|
||||||
run: |
|
|
||||||
version_dev="dev$(date --utc +'%Y%m%d')"
|
|
||||||
echo "Development version \"${version_dev}\""
|
|
||||||
echo "version_dev=${version_dev}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Create build matrix
|
- name: Create build matrix
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
id: generate_matrix
|
id: generate_matrix
|
||||||
@ -138,6 +147,13 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Set version suffix
|
||||||
|
if: ${{ github.event_name != 'release' }}
|
||||||
|
env:
|
||||||
|
VERSION_DEV: ${{ needs.prepare.outputs.version_dev }}
|
||||||
|
run: |
|
||||||
|
sed -E "s/(^VERSION_SUFFIX=\").*(\"$)/\1${VERSION_DEV}\2/" buildroot-external/meta
|
||||||
|
|
||||||
- name: 'Add release PKI certs'
|
- name: 'Add release PKI certs'
|
||||||
env:
|
env:
|
||||||
RAUC_CERTIFICATE: ${{ secrets.RAUC_CERTIFICATE }}
|
RAUC_CERTIFICATE: ${{ secrets.RAUC_CERTIFICATE }}
|
||||||
@ -175,7 +191,7 @@ jobs:
|
|||||||
-e BUILDER_UID="${BUILDER_UID}" -e BUILDER_GID="${BUILDER_GID}" \
|
-e BUILDER_UID="${BUILDER_UID}" -e BUILDER_GID="${BUILDER_GID}" \
|
||||||
-v "/mnt/cache:/cache" \
|
-v "/mnt/cache:/cache" \
|
||||||
${{ needs.prepare.outputs.build_container_image }} \
|
${{ needs.prepare.outputs.build_container_image }} \
|
||||||
make BUILDDIR=/build VERSION_DEV=${{ needs.prepare.outputs.version_dev }} ${{ matrix.board.defconfig }}
|
make BUILDDIR=/build ${{ matrix.board.defconfig }}
|
||||||
|
|
||||||
- name: Upload images
|
- name: Upload images
|
||||||
if: ${{ github.event_name != 'release' }}
|
if: ${{ github.event_name != 'release' }}
|
||||||
@ -184,7 +200,7 @@ jobs:
|
|||||||
rsh: -q
|
rsh: -q
|
||||||
switches: -aW
|
switches: -aW
|
||||||
path: output/images/haos_*
|
path: output/images/haos_*
|
||||||
remote_path: ${{ secrets.DEV_TARGET_PATH }}/${{ needs.prepare.outputs.version_main }}.${{ needs.prepare.outputs.version_dev }}/
|
remote_path: ${{ secrets.DEV_TARGET_PATH }}/${{ needs.prepare.outputs.version_full }}/
|
||||||
remote_host: ${{ secrets.DEV_HOST }}
|
remote_host: ${{ secrets.DEV_HOST }}
|
||||||
remote_port: ${{ secrets.DEV_PORT }}
|
remote_port: ${{ secrets.DEV_PORT }}
|
||||||
remote_user: ${{ secrets.DEV_USERNAME }}
|
remote_user: ${{ secrets.DEV_USERNAME }}
|
||||||
@ -228,5 +244,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
key: "hassos[]"
|
key: "hassos[]"
|
||||||
key-description: "Home Assistant OS"
|
key-description: "Home Assistant OS"
|
||||||
version: ${{ needs.prepare.outputs.version_main }}.${{ needs.prepare.outputs.version_dev }}
|
version: ${{ needs.prepare.outputs.version_full }}
|
||||||
channel: ${{ needs.prepare.outputs.channel }}
|
channel: ${{ needs.prepare.outputs.channel }}
|
||||||
|
4
Makefile
4
Makefile
@ -3,8 +3,6 @@ BUILDDIR:=$(shell pwd)
|
|||||||
BUILDROOT=$(BUILDDIR)/buildroot
|
BUILDROOT=$(BUILDDIR)/buildroot
|
||||||
BUILDROOT_EXTERNAL=$(BUILDDIR)/buildroot-external
|
BUILDROOT_EXTERNAL=$(BUILDDIR)/buildroot-external
|
||||||
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs
|
DEFCONFIG_DIR = $(BUILDROOT_EXTERNAL)/configs
|
||||||
VERSION_DATE := $(shell date --utc +'%Y%m%d')
|
|
||||||
VERSION_DEV := "dev$(VERSION_DATE)"
|
|
||||||
|
|
||||||
TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
TARGETS := $(notdir $(patsubst %_defconfig,%,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||||
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
TARGETS_CONFIG := $(notdir $(patsubst %_defconfig,%-config,$(wildcard $(DEFCONFIG_DIR)/*_defconfig)))
|
||||||
@ -32,7 +30,7 @@ $(TARGETS_CONFIG): %-config:
|
|||||||
|
|
||||||
$(TARGETS): %: %-config
|
$(TARGETS): %: %-config
|
||||||
@echo "build $@"
|
@echo "build $@"
|
||||||
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL) VERSION_DEV=$(VERSION_DEV)
|
$(MAKE) -C $(BUILDROOT) O=$(O) BR2_EXTERNAL=$(BUILDROOT_EXTERNAL)
|
||||||
|
|
||||||
# Do not clean when building for one target
|
# Do not clean when building for one target
|
||||||
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
|
ifneq ($(words $(filter $(TARGETS),$(MAKECMDGOALS))), 1)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
VERSION_MAJOR=11
|
VERSION_MAJOR="11"
|
||||||
VERSION_BUILD=0
|
VERSION_MINOR="0"
|
||||||
|
VERSION_SUFFIX="dev0"
|
||||||
|
|
||||||
HASSOS_NAME="Home Assistant OS"
|
HASSOS_NAME="Home Assistant OS"
|
||||||
HASSOS_ID="haos"
|
HASSOS_ID="haos"
|
||||||
|
@ -9,10 +9,10 @@ function hassos_rauc_compatible() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hassos_version() {
|
function hassos_version() {
|
||||||
if [ -z "${VERSION_DEV}" ]; then
|
if [ -z "${VERSION_SUFFIX}" ]; then
|
||||||
echo "${VERSION_MAJOR}.${VERSION_BUILD}"
|
echo "${VERSION_MAJOR}.${VERSION_MINOR}"
|
||||||
else
|
else
|
||||||
echo "${VERSION_MAJOR}.${VERSION_BUILD}.${VERSION_DEV}"
|
echo "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_SUFFIX}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user