mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-05 08:12:26 -08:00
Bumps the minor-and-patches group with 2 updates: [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [docker/login-action](https://github.com/docker/login-action). Updates `astral-sh/setup-uv` from 8.2.0 to 8.3.2 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](https://github.com/astral-sh/setup-uv/compare/fac544c07dec837d0ccb6301d7b5580bf5edae39...11f9893b081a58869d3b5fccaea48c9e9e46f990) Updates `docker/login-action` from 4.3.0 to 4.4.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/c99871dec2022cc055c062a10cc1a1310835ceb4...af1e73f918a031802d376d3c8bbc3fe56130a9b0) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: 8.3.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patches - dependency-name: docker/login-action dependency-version: 4.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patches ... Signed-off-by: dependabot[bot] <[email protected]>
277 lines
9.7 KiB
YAML
277 lines
9.7 KiB
YAML
# Copyright 2024-2025 New Vector Ltd
|
||
# Copyright 2025-2026 Element Creations Ltd
|
||
#
|
||
# SPDX-License-Identifier: AGPL-3.0-only
|
||
|
||
name: Helm Chart packaging and releasing
|
||
on:
|
||
pull_request:
|
||
push:
|
||
branches:
|
||
- main
|
||
- 'maintenance/*'
|
||
tags:
|
||
- '[0-9]+.[0-9]+.[0-9]+'
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
test-suite-package:
|
||
permissions:
|
||
contents: read
|
||
packages: write
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- name: Install uv
|
||
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
||
with:
|
||
# We disable cache for releases to avoid cache poisoning
|
||
enable-cache: ${{ github.ref_type != 'tag' }}
|
||
activate-environment: true
|
||
|
||
- name: Set up UV environment
|
||
run: uv sync --all-packages
|
||
|
||
- name: Set version
|
||
env:
|
||
GITHUB_RUN_ID: "${{ github.run_id }}"
|
||
run: |
|
||
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
|
||
uv --directory tests/ version "${GITHUB_REF_NAME#ess-community-integration-tests-v}"
|
||
else
|
||
uv version --directory tests/ --bump "dev=$GITHUB_RUN_ID"
|
||
fi
|
||
|
||
# Because pyhelm3 is a git ref, the package cannot use it as direct dependencies when pushing to Pypi
|
||
# Instead we manually vendor pyhelm3 in the package when releasing it in CI
|
||
- name: Fetch pyhelm3
|
||
run: |
|
||
# Extract the Git reference for pyhelm3 from pyproject.toml
|
||
PYHELM_GIT_REF=$(grep -oP 'pyhelm3 @ git\+https://github.com/element-hq/pyhelm3.git@\K[^"]+' tests/pyproject.toml)
|
||
if [ -z "$PYHELM_GIT_REF" ]; then
|
||
echo "Error: Could not extract pyhelm3 Git reference from pyproject.toml."
|
||
exit 1
|
||
fi
|
||
echo "Extracted pyhelm3 Git reference: $PYHELM_GIT_REF"
|
||
|
||
# Clone and checkout the specific commit of pyhelm3
|
||
git clone https://github.com/element-hq/pyhelm3.git
|
||
cd pyhelm3
|
||
git checkout "$PYHELM_GIT_REF"
|
||
cd -
|
||
mv pyhelm3/pyhelm3 tests/pyhelm3
|
||
rm -rf pyhelm3
|
||
|
||
# Patch pyproject.toml to remove pyhelm3 dependency
|
||
sed -i '/pyhelm3 @ git+https:\/\/github.com\/element-hq\/pyhelm3.git@'"$PYHELM_GIT_REF/d" "tests/pyproject.toml"
|
||
sed -i 's/\(module-name = "integration"\)/module-name = ["pyhelm3", "integration"]/' "tests/pyproject.toml"
|
||
|
||
- name: Build
|
||
run: uv build --package ess-community-integration-tests
|
||
|
||
# Check that basic features work and we didn't miss to include crucial files
|
||
- name: Smoke test (source distribution)
|
||
run: uv run --isolated --no-project --with dist/*.tar.gz pytest-ess --test-suite synapse -- --setup-plan
|
||
|
||
- name: Dry-run Publish ESS test suite to PyPI
|
||
run: uv publish --dry-run dist/*
|
||
|
||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||
with:
|
||
name: ess-community-integration-tests-dist
|
||
# As only a single path and nothing after the wildcard, the uploaded artifact won't have the dist/ directory structure
|
||
# https://github.com/actions/upload-artifact?tab=readme-ov-file#upload-using-multiple-paths-and-exclusions
|
||
path: |
|
||
dist/*
|
||
retention-days: 1
|
||
|
||
helm-package:
|
||
permissions:
|
||
contents: read
|
||
packages: write
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- name: Install uv
|
||
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
||
with:
|
||
enable-cache: true
|
||
activate-environment: true
|
||
|
||
- name: Set up UV environment
|
||
run: uv sync
|
||
|
||
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||
|
||
- name: Set version
|
||
run: |
|
||
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
|
||
scripts/check_semver.py "$GITHUB_REF_NAME"
|
||
scripts/set_chart_version.sh "$GITHUB_REF_NAME"
|
||
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_target" ]; then
|
||
actual_pr_head_commit=$(yq --input-format json -r '.pull_request.head.sha' "$GITHUB_EVENT_PATH")
|
||
version=$(yq '.version' charts/matrix-stack/Chart.yaml | sed "s/-dev/-sha$actual_pr_head_commit/")
|
||
scripts/set_chart_version.sh "$version"
|
||
elif [ "$GITHUB_EVENT_NAME" != "main" ]; then
|
||
version=$(yq '.version' charts/matrix-stack/Chart.yaml | sed "s/-dev/-sha$GITHUB_SHA/")
|
||
scripts/set_chart_version.sh "$version"
|
||
else
|
||
echo "Did not set chart version on event $GITHUB_EVENT_NAME: $GITHUB_REF_TYPE/$GITHUB_REF_NAME"
|
||
fi
|
||
|
||
- name: Login to GitHub Container Registry
|
||
if: ${{ github.event_name != 'pull_request' }}
|
||
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
|
||
with:
|
||
registry: ghcr.io
|
||
username: ${{ github.actor }}
|
||
password: ${{ github.token }}
|
||
|
||
- name: Set helm changes annotations
|
||
run: |
|
||
scripts/towncrier_to_helm_annotation.py charts/matrix-stack
|
||
|
||
- name: Generate changelog
|
||
run: |
|
||
version=$(yq '.version' charts/matrix-stack/Chart.yaml)
|
||
# Add changes to CHANGELOG.md, keep files to generate CHANGELOG.latest.md
|
||
towncrier build --version "$version" --keep
|
||
# in empty file
|
||
sed -i "s/CHANGELOG.md/CHANGELOG.latest.md/" pyproject.toml
|
||
towncrier build --version "$version" --yes
|
||
sed -i "s/CHANGELOG.latest.md/CHANGELOG.md/" pyproject.toml
|
||
|
||
- name: Helm package
|
||
run: |
|
||
cd charts/matrix-stack
|
||
helm package .
|
||
|
||
- name: Helm push
|
||
if: ${{ github.event_name != 'pull_request' }}
|
||
run: helm push charts/matrix-stack/matrix-stack-*.tgz oci://ghcr.io/${{ github.repository }}
|
||
|
||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||
with:
|
||
name: helm-package
|
||
path: |
|
||
charts/matrix-stack/*.tgz*
|
||
CHANGELOG.md
|
||
CHANGELOG.latest.md
|
||
retention-days: 1
|
||
|
||
release:
|
||
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
|
||
permissions:
|
||
contents: write
|
||
packages: read
|
||
pull-requests: write
|
||
needs:
|
||
- helm-package
|
||
- test-suite-package
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||
with:
|
||
# We are creating a commit changing the chart version for the next version PR
|
||
persist-credentials: true
|
||
|
||
- name: Grab packaged chart
|
||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||
with:
|
||
name: helm-package
|
||
path: ./
|
||
|
||
- name: Install uv
|
||
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
||
with:
|
||
enable-cache: true
|
||
activate-environment: true
|
||
|
||
- name: Set up UV environment
|
||
run: uv sync
|
||
|
||
- name: Calculate versions
|
||
id: versions
|
||
run: |
|
||
this_version=$(find charts/matrix-stack -name 'matrix-stack-*.tgz' | sed 's/.*matrix-stack-//;s/.tgz//')
|
||
next_version=$(echo "$this_version" | sed 's/-dev//' | awk -F'[ .]' '{print $1"."$2"."$3+1"-dev"}')
|
||
scripts/set_chart_version.sh "$next_version"
|
||
|
||
echo "this-version=$this_version" >> "$GITHUB_OUTPUT"
|
||
echo "next-version=$next_version" >> "$GITHUB_OUTPUT"
|
||
|
||
- name: Release
|
||
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
|
||
with:
|
||
draft: true
|
||
body_path: CHANGELOG.latest.md
|
||
files: charts/matrix-stack/matrix-stack*.tgz*
|
||
fail_on_unmatched_files: true
|
||
# This could simply be omitted if we didn't want to test without a tag
|
||
tag_name: "${{ steps.versions.outputs.this-version }}"
|
||
|
||
- name: Remove latest changelog
|
||
run: |
|
||
rm CHANGELOG.latest.md
|
||
rm newsfragments/*.md
|
||
touch newsfragments/.gitkeep
|
||
|
||
- name: Create PR for next patch version
|
||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||
with:
|
||
branch: "gha/bump-to-${{ steps.versions.outputs.next-version }}"
|
||
base: "main"
|
||
commit-message: "Bump chart version to ${{ steps.versions.outputs.next-version }}"
|
||
title: "Bump chart version to ${{ steps.versions.outputs.next-version }} after release"
|
||
labels: automated,version-bump
|
||
body: |
|
||
${{ steps.versions.outputs.this-version }} has just been released.
|
||
This PR prepares the chart & dependencies for the next release:
|
||
${{ steps.versions.outputs.next-version }}.
|
||
|
||
The target branch may be wrong. In which case this PR should be taken over and manually adjusted.
|
||
|
||
release-integration-tests:
|
||
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
|
||
permissions:
|
||
packages: read
|
||
id-token: write
|
||
environment: pypi
|
||
needs:
|
||
- release
|
||
- test-suite-package
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
|
||
- name: Checkout
|
||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- name: Install uv
|
||
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
||
with:
|
||
enable-cache: true
|
||
activate-environment: true
|
||
|
||
- name: Set up UV environment
|
||
run: uv sync
|
||
|
||
- name: Grab packaged test-suite
|
||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||
with:
|
||
name: ess-community-integration-tests-dist
|
||
path: dist/
|
||
|
||
- name: Publish ESS test suite to PyPI
|
||
run: uv publish dist/*
|