Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create GitHub Release
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated

on:
push:
tags:
- '**'
workflow_dispatch:
inputs:
tag:
description: "Existing git tag to release (for example: v1.2.3)"
required: true
type: string

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-24.04
env:
TAG: ${{ inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v6
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
with:
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.ref }}
Comment thread
sgn4sangar marked this conversation as resolved.

- name: Setup Python & Poetry Environment
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
uses: exasol/python-toolbox/.github/actions/python-environment@v9
with:
python-version: "3.10"
poetry-version: "2.3.0"

- name: Prepare release changelog
run: poetry run -- nox -s prepare-release -- --tag "$TAG"
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated

- name: Create draft GitHub release
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
env:
GH_TOKEN: ${{ github.token }}
run: |
changes_file="doc/changes/changes_${TAG}.md"
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
test -f "$changes_file"
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
gh release create "$TAG" \
--draft \
--title "$TAG" \
--notes-file "$changes_file"
35 changes: 35 additions & 0 deletions noxfile.py
Comment thread
sgn4sangar marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
from pathlib import Path

from exasol.slc_ci_setup.nox.tasks import *
Expand All @@ -9,6 +10,40 @@
nox.options.sessions = []


@nox.session(name="prepare-release", python=False)
def prepare_release(session: nox.Session):
"""Prepare changelog files for the supplied release tag."""
parser = argparse.ArgumentParser(
usage=f"nox -s {session.name} -- --tag <tag>",
)
parser.add_argument("--tag", required=True, help="Release tag")
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
tag = parser.parse_args(session.posargs).tag

if Path(tag).name != tag:
session.error("Release tag must not contain a path separator.")

Comment thread
sgn4sangar marked this conversation as resolved.
changes_dir = ROOT / "doc" / "changes"
unreleased_file = changes_dir / "unreleased.md"
changes_file = changes_dir / f"changes_{tag}.md"
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
changelog_file = changes_dir / "changelog.md"

if not unreleased_file.is_file():
session.error(f"Unreleased changelog file does not exist: {unreleased_file}")
if changes_file.exists():
session.error(f"Release changelog file already exists: {changes_file}")

changelog = changelog_file.read_text()
changelog_heading = "# Changes\n"
if not changelog.startswith(changelog_heading):
session.error(f"Unexpected changelog heading in: {changelog_file}")

release_entry = f"* [{tag}](changes_{tag}.md)\n"
Comment thread
sgn4sangar marked this conversation as resolved.
Outdated
changelog_file.write_text(
f"{changelog_heading}\n{release_entry}{changelog[len(changelog_heading):].lstrip()}"
)
unreleased_file.rename(changes_file)


def get_oft_jar(session: nox.Session) -> Path:
oft_version = "4.1.0"
oft_jar = Path.home() / ".m2" / "repository" / "org" / "itsallcode" / "openfasttrace" / "openfasttrace" / oft_version / f"openfasttrace-{oft_version}.jar"
Expand Down