Skip to content

Commit 5d460f1

Browse files
authored
Post release actions (#8287)
This PR adds an action that runs after a release is published to handle the bulk of the post-release tasks. Example: #8206 A script is executed, which: * sets the new `previous_version` in version.config * get the updated CHANGELOG.md * get the up & down grade SQL files * set the up & down grade files in CMakeList.txt What is **not** covered: * bumping the `version` to the next minor in version.config * removing the delta of deleted .unreleased files AND added a missing downgrade file
1 parent 6fd437c commit 5d460f1

3 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release - Post Release Ceremony
2+
"on":
3+
release:
4+
types: [published]
5+
6+
# The workflow needs the permission to a PR
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
post-release-ceremony:
13+
name: Post Release Ceremony
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout TimescaleDB
18+
uses: actions/checkout@v4
19+
20+
- name: Forward port changes to main
21+
run: |
22+
./scripts/release/build_post_release_artefacts.sh ${{ github.event.release.tag_name }}
23+
24+
- name: Create Pull Request for forward ported artefacts
25+
id: cpr_fwdp
26+
uses: peter-evans/create-pull-request@v7
27+
with:
28+
token: ${{ secrets.ORG_AUTOMATION_TOKEN }}
29+
branch: "release/${{ github.event.release.tag_name }}--forwardport"
30+
base: "main"
31+
delete-branch: true
32+
title: "Forwardport ${{ github.event.release.tag_name }}"
33+
body: |
34+
- CHANGELOG
35+
- set previous_version in version.config
36+
- adjust CMakeList.txt with up & down grade files
37+
- TODO removed .unreleased files
38+
labels: |
39+
release
40+
add-paths: |
41+
.unreleased/*
42+
CHANGELOG.md
43+
version.config
44+
sql/updates/*.sql
45+
sql/CMakeLists.txt
46+
47+
- name: "Validate next version PR"
48+
if: ${{ steps.cpr_fwdp.outputs.pull-request-number }}
49+
run: |
50+
echo "Pull Request: ${{ steps.cpr_fwdp.outputs.pull-request-url }}"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
#
4+
# Build the necessary artefacts for the forwardporting the
5+
# the release to `main` (Minor & Patch)
6+
# - up & down files for the next version
7+
# - latest.sql & reverse.sql
8+
# - sets new version in version.config
9+
# - adjusts the CMakeLists.txt
10+
#
11+
# Param: <published_version>
12+
#
13+
14+
set -eu
15+
16+
if [ "$#" -ne 1 ]; then
17+
echo "${0} <published_version>"
18+
exit 2
19+
fi
20+
21+
PUBLISHED_VERSION=$1
22+
PREVIOUS_VERSION=$(tail -1 version.config | cut -d ' ' -f 3 | cut -d '-' -f 1)
23+
24+
echo "fetch the up & downgrade files"
25+
URL_UPGRADE="https://raw.githubusercontent.com/timescale/timescaledb/refs/tags/${PUBLISHED_VERSION}/sql/updates/${PREVIOUS_VERSION}--${PUBLISHED_VERSION}.sql"
26+
URL_DOWNGRADE="https://raw.githubusercontent.com/timescale/timescaledb/refs/tags/${PUBLISHED_VERSION}/sql/updates/${PUBLISHED_VERSION}--${PREVIOUS_VERSION}.sql"
27+
echo $URL_UPGRADE
28+
curl --fail -o sql/updates/${PREVIOUS_VERSION}--${PUBLISHED_VERSION}.sql $URL_UPGRADE
29+
curl --fail -o sql/updates/${PUBLISHED_VERSION}--${PREVIOUS_VERSION}.sql $URL_DOWNGRADE
30+
31+
# find last up & down grade files
32+
LAST_UPDATE_FILE=$(find sql/updates/*--${PREVIOUS_VERSION}.sql | head -1 | cut -d '/' -f 3)
33+
LAST_DOWNGRADE_FILE=$(find sql/updates/${PREVIOUS_VERSION}--*.sql | head -1 | cut -d '/' -f 3)
34+
35+
echo "register upgrade sql file"
36+
gawk -i inplace '/'${LAST_UPDATE_FILE}')/ { print; print " updates/'${PREVIOUS_VERSION}'--'${PUBLISHED_VERSION}'.sql)"; next }1' ./sql/CMakeLists.txt
37+
sed -i.bak "s/${LAST_UPDATE_FILE})/${LAST_UPDATE_FILE}/g" ./sql/CMakeLists.txt
38+
39+
echo "register downgrade sql file"
40+
gawk -i inplace '/'${LAST_DOWNGRADE_FILE}')/ { print; print " '${PUBLISHED_VERSION}'--'${PREVIOUS_VERSION}'.sql)"; next }1' ./sql/CMakeLists.txt
41+
sed -i.bak "s/${LAST_DOWNGRADE_FILE})/${LAST_DOWNGRADE_FILE}/g" ./sql/CMakeLists.txt
42+
43+
# CHANGELOG
44+
echo "fetching CHANGELOG"
45+
URL_CHANGELOG="https://raw.githubusercontent.com/timescale/timescaledb/refs/tags/${PUBLISHED_VERSION}/CHANGELOG.md"
46+
curl --silent --fail -o CHANGELOG.md $URL_CHANGELOG
47+
48+
# .unreleased files
49+
echo "remove .unreleased files"
50+
echo "TODO"
51+
52+
# Set new previous version
53+
echo "Set new previous version version.config to ${PUBLISHED_VERSION}"
54+
sed -i.bak "s/${PREVIOUS_VERSION}/${PUBLISHED_VERSION}/g" version.config
55+
rm version.config.bak
56+
tail -n 1 version.config

sql/updates/2.20.2--2.20.1.sql

Whitespace-only changes.

0 commit comments

Comments
 (0)