Skip to content

Commit

Permalink
Prepare repository for multiple Tomcat versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax committed Dec 11, 2023
1 parent 929569f commit 53ee029
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
directory: "/webapp-runner-9"
schedule:
interval: "monthly"
labels:
- "skip changelog"
- "tomcat 9"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ jobs:
uses: actions/checkout@v4
- name: Check that CHANGELOG is touched
run: |
git fetch origin ${{ github.base_ref }} --depth 1 && \
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
git fetch origin ${{ github.base_ref }} --depth 1 || exit 1
changed_root_dirs=$(git diff remotes/origin/main --name-only | awk -F'/' 'NF!=1{print $1}' | grep '^webapp-runner-' | uniq)
for changed_root_dir in $changed_root_dirs; do
git diff remotes/origin/${{ github.base_ref }} --name-only | grep "${changed_root_dir}/CHANGELOG.md" || exit 1
done
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,35 @@ permissions:

jobs:
maven:
name: "Execute build, run tests (Java ${{ matrix.java-version }})"
name: "Execute build, run tests (Tomcat ${{ matrix.major-version }}, Java ${{ matrix.java-version }})"
runs-on: ubuntu-22.04
strategy:
matrix:
java-version:
- 11
major-version:
- 9
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java-version }}
- run: "./mvnw --batch-mode clean verify package"
working-directory: webapp-runner-${{ matrix.major-version }}

version-check:
name: "Check POM version constraints"
name: "Check POM version constraints (Tomcat ${{ matrix.major-version }})"
runs-on: ubuntu-22.04
strategy:
matrix:
major-version:
- 9
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
- run: ./scripts/check-version.sh
- run: ../scripts/check-version.sh
working-directory: webapp-runner-${{ matrix.major-version }}
20 changes: 18 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Prepare release

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
major-version:
description: 'Major Version'
required: true
default: '9'
type: choice
options:
- '9'

defaults:
run:
Expand Down Expand Up @@ -32,16 +41,22 @@ jobs:

- name: Record latest release version
id: old-version
run: echo "version=$(gh release view --json tagName | jq -j '.tagName | sub("v"; "")')" >> "${GITHUB_OUTPUT}"
# We can't just use `gh release view` since we have to deal with multiple versions that may semantically the
# "latest version", depending on the subproject we prepare the release for. Additionally, `gh release list`
# does not support JSON output at the time of writing: https://github.com/cli/cli/issues/4572
run: echo "version=$(gh api /repos/heroku/webapp-runner/releases | jq -j 'map(select(.tag_name | startswith("v${{ inputs.major-version }}"))) | sort_by(.published_at | fromdateiso8601) | last | .tag_name[1:]')" >> "${GITHUB_OUTPUT}"
working-directory: webapp-runner-${{ inputs.major-version }}
env:
GH_TOKEN: ${{ steps.generate-token.outputs.app_token }}

- name: Drop -SNAPSHOT suffix from version
run: ./mvnw versions:set -DremoveSnapshot -DgenerateBackupPoms=false
working-directory: webapp-runner-${{ inputs.major-version }}

- name: Record new version
id: new-version
run: echo "version=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -B -DforceStdout)" >> "${GITHUB_OUTPUT}"
working-directory: webapp-runner-${{ inputs.major-version }}

- name: Update changelog
run: |
Expand All @@ -55,6 +70,7 @@ jobs:
--expression "s~(^## \[Unreleased\])$~\1\n\n\n## [${NEW_VERSION}] - ${DATE_TODAY}~" \
--expression "s~(^\[unreleased\]:) .*$~\1 ${UNRELEASED_URL}\n[${NEW_VERSION}]: ${NEW_VERSION_URL}~" \
CHANGELOG.md
working-directory: webapp-runner-${{ inputs.major-version }}

- name: Create pull request
id: pr
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Release

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
major-version:
description: 'Major Version'
required: true
default: '9'
type: choice
options:
- '9'

defaults:
run:
Expand Down Expand Up @@ -44,6 +53,7 @@ jobs:
- name: Record new version
id: new-version
run: echo "version=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -B -DforceStdout)" >> "${GITHUB_OUTPUT}"
working-directory: webapp-runner-${{ inputs.major-version }}

- name: Check GitHub release does not already exist
run: |
Expand All @@ -61,12 +71,13 @@ jobs:
run: |
{
echo 'content<<CHANGELOG_END'
awk '/^## \[${{ steps.new-version.outputs.version }}\]/{flag=1; next} /^## /{flag=0} flag' CHANGELOG.md
awk '/^## \[${{ steps.new-version.outputs.version }}\]/{flag=1; next} /^## /{flag=0} flag' webapp-runner-${{ inputs.major-version }}/CHANGELOG.md
echo CHANGELOG_END
} >> "${GITHUB_OUTPUT}"
- name: Deploy project
run: ./mvnw --batch-mode deploy
working-directory: webapp-runner-${{ inputs.major-version }}
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
Expand All @@ -85,6 +96,7 @@ jobs:

- name: Update version
run: ./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion="${{ steps.next-version.outputs.version }}"
working-directory: webapp-runner-${{ inputs.major-version }}

- name: Create pull request
id: pr
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions CHANGELOG.md → webapp-runner-9/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

- Update release process. ([#389](https://github.com/heroku/webapp-runner/pull/389))

## [9.0.83.0] - 2023-11-20

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 53ee029

Please sign in to comment.