70 lines
2.7 KiB
YAML
70 lines
2.7 KiB
YAML
name: Build Bifrost
|
|
|
|
on:
|
|
push:
|
|
branches: ["**"]
|
|
tags: ["v*.*.*"]
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
workflow_dispatch:
|
|
inputs:
|
|
revision:
|
|
description: "Optional version override for a manual build"
|
|
required: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout full history and tags
|
|
uses: actions/checkout@v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up pinned Java
|
|
uses: actions/setup-java@v4.7.1
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17.0.13+11"
|
|
cache: maven
|
|
- name: Calculate project version
|
|
id: version
|
|
run: |
|
|
revision=$(sh scripts/version.sh)
|
|
if [ -n "$REVISION_OVERRIDE" ]; then revision="$REVISION_OVERRIDE"; fi
|
|
echo "revision=$revision" >> "$GITHUB_OUTPUT"
|
|
echo "release_version=$(sh scripts/version.sh --next-release)" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
REVISION_OVERRIDE: ${{ github.event.inputs.revision }}
|
|
- name: Validate changelog on pull requests
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
sh scripts/check-changelog.sh
|
|
echo "Changelog preview:"
|
|
awk '/^## \[Unreleased\]$/ {show=1; next} /^## \[/ {show=0} show {print}' CHANGELOG.md
|
|
- name: Build and run unit tests
|
|
env:
|
|
BUILD_REVISION: ${{ steps.version.outputs.revision }}
|
|
run: |
|
|
sh scripts/render-readme.sh "$BUILD_REVISION"
|
|
sh ./mvnw -B -Drevision="$BUILD_REVISION" verify
|
|
- name: Build release version
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
|
|
env:
|
|
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
|
|
run: |
|
|
sh scripts/render-readme.sh "$RELEASE_VERSION"
|
|
sh ./mvnw -B -Drevision="$RELEASE_VERSION" verify
|
|
- name: Create release commit, tag, and Gitea release
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
GITEA_REPOSITORY: ${{ github.repository }}
|
|
GITEA_SERVER_URL: ${{ github.server_url }}
|
|
GITEA_MAIN_BRANCH: main
|
|
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
|
|
run: |
|
|
export GITEA_API_URL="${GITEA_SERVER_URL%/}/api/v1"
|
|
export GITEA_REPOSITORY_URL="${GITEA_SERVER_URL%/}/${GITEA_REPOSITORY}"
|
|
git remote set-url origin "${GITEA_REPOSITORY_URL}.git"
|
|
sh scripts/release.sh "$RELEASE_VERSION"
|