diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce54f976..a77191d6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -99,10 +99,32 @@ jobs: name: openapi-artifact path: openapi.tar.gz + generate-changelog: + name: "📢 Run towncrier for changelog" + # skip for builds of git tags + if: "!startsWith(github.ref, 'refs/tags/')" + runs-on: ubuntu-latest + steps: + - name: "📥 Source checkout" + uses: actions/checkout@v2 + - name: "➕ Setup Python" + uses: actions/setup-python@v4 + - name: "➕ Install towncrier" + run: "pip install 'towncrier'" + - name: "Generate changelog" + run: ./scripts/generate-changelog.sh vUNSTABLE + - name: "📤 Artifact upload" + uses: actions/upload-artifact@v2 + with: + name: changelog-artifact + path: content/changelog/vUNSTABLE.md + build-spec: name: "📖 Build the spec" runs-on: ubuntu-latest - needs: [calculate-baseurl, build-openapi] + needs: [calculate-baseurl, build-openapi, generate-changelog] + # run even if generate-changelog was skipped + if: ${{ always() }} steps: - name: "➕ Setup Node" uses: actions/setup-node@v2 @@ -119,9 +141,14 @@ jobs: run: | npm i npm run get-proposals + - name: "📥 Download generated changelog" + if: "needs.generate-changelog.result == 'success'" + uses: actions/download-artifact@v3 + with: + name: changelog-artifact + path: content/changelog - name: "⚙️ hugo" run: hugo --baseURL "${{ needs.calculate-baseurl.outputs.baseURL }}" -d "spec" - # We manually unpack the spec OpenAPI definition JSON to the website tree # to make it available to the world in a canonical place: # https://spec.matrix.org/latest/client-server-api/api.json diff --git a/changelogs/internal/newsfragments/1340.clarification b/changelogs/internal/newsfragments/1340.clarification new file mode 100644 index 00000000..a3180440 --- /dev/null +++ b/changelogs/internal/newsfragments/1340.clarification @@ -0,0 +1 @@ +Generate the unstable changelogs with towncrier, for consistency. diff --git a/content/changelog.md b/content/changelog/index.md similarity index 85% rename from content/changelog.md rename to content/changelog/index.md index a84514b6..560cb43b 100644 --- a/content/changelog.md +++ b/content/changelog/index.md @@ -6,13 +6,7 @@ weight: 1000 {{% changelog/changelog-description %}} -{{% changelog/changelog-changes %}} - - -{{% changelog/changelog-rendered p="changelogs/v1.4.md" %}} -{{% changelog/changelog-rendered p="changelogs/v1.3.md" %}} -{{% changelog/changelog-rendered p="changelogs/v1.2.md" %}} -{{% changelog/changelog-rendered p="changelogs/v1.1.md" %}} +{{% changelog/changelogs %}}

Historical versions

diff --git a/layouts/partials/changelogs/v1.1.md b/content/changelog/v1.1.md similarity index 99% rename from layouts/partials/changelogs/v1.1.md rename to content/changelog/v1.1.md index b8e0832d..8cf43878 100644 --- a/layouts/partials/changelogs/v1.1.md +++ b/content/changelog/v1.1.md @@ -1,3 +1,6 @@ +--- +date: 2021-11-09T00:00:00+0000 +--- " +VERSION="$1" +DATE="$2" -cd changelogs +cd `dirname $0`/../changelogs # Pre-cleanup just in case it wasn't done on the last run -rm -f rendered.* +rm -f rendered.md # Reversed order so that room versions ends up on the bottom towncrier --name "Internal Changes/Tooling" --dir "./internal" --config "./pyproject.toml" --yes @@ -21,18 +23,24 @@ towncrier --name "Application Service API" --dir "./application_service" --confi towncrier --name "Server-Server API" --dir "./server_server" --config "./pyproject.toml" --yes towncrier --name "Client-Server API" --dir "./client_server" --config "./pyproject.toml" --yes -# Prepare the header -cp header.md rendered.header.md -sed -i "s/VERSION/$1/g" rendered.header.md -sed -i "s/DATE/$2/g" rendered.header.md -cat rendered.header.md rendered.md > rendered.final.md - -# Remove trailing whitespace (such as our intentionally blank RST headings) -sed -i "s/[ ]*$//" rendered.final.md - -# Put the changelog in place -mv rendered.final.md ../layouts/partials/changelogs/$1.md -sed -i "s/$MAGIC_STRING/$MAGIC_STRING\n{{% changelog\\/changelog-rendered p=\"changelogs\\/$1.md\" %}}/" ../content/changelog.md +{ + # Prepare the header + # We include the generation date in the front matter so that we can use it + # to sort the changelogs at build time. + cat < ../content/changelog/$VERSION.md # Cleanup -rm -v rendered.* +rm -v rendered.md