Skip to content

fix(): checkbox trailing section (#1489) #2444

fix(): checkbox trailing section (#1489)

fix(): checkbox trailing section (#1489) #2444

Workflow file for this run

name: OpenFrame OSS Libs Release
permissions:
contents: read
packages: write
on:
push:
branches: [main]
workflow_dispatch:
inputs:
target:
description: 'What to release'
required: true
type: choice
options:
- java
- node
- rust
version:
description: 'Version to release OSS Libs (x.y.z). Leave empty for auto patch bump.'
required: false
type: string
default: ''
env:
REGISTRY: "com.openframe.oss"
ARTIFACT_REGISTRY: "com/openframe/oss"
ORGANISATION: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
# =============================================================================
# JOBS
# =============================================================================
jobs:
changes:
name: Changes
uses: ./.github/workflows/changes.yml
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push'
matrix:
name: Matrix
uses: ./.github/workflows/matrix.yml
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push'
release-java:
name: Release Java
runs-on: ubuntu-latest
needs: changes
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'java') ||
(github.event_name == 'push' && needs.changes.outputs.java == 'true')
steps:
- uses: actions/checkout@v4
- name: Set up Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Get Previous Version
env:
MAVEN_REGISTRY: maven.pkg.github.com
GITHUB_TOKEN: ${{ github.token }}
run: |
URL="https://$MAVEN_REGISTRY/${{ env.ORGANISATION }}/${{ env.REPOSITORY }}/${{ env.ARTIFACT_REGISTRY }}/${{ env.REPOSITORY }}/maven-metadata.xml"
OLD_VERSION=$(curl -sf -H "Authorization: token $GITHUB_TOKEN" "$URL" | \
grep -oP '<version>\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1)
OLD_VERSION=${OLD_VERSION:-0.0.0}
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
echo "Found old version: $OLD_VERSION"
- name: Set Snapshot Version
if: github.event_name == 'push'
run: |
echo "NEW_VERSION=${{ env.OLD_VERSION }}-SNAPSHOT" >> $GITHUB_ENV
echo "${{ env.OLD_VERSION }} → ${{ env.OLD_VERSION }}-SNAPSHOT"
- name: Set Release Version
if: github.event_name == 'workflow_dispatch'
env:
NEW_VERSION: ${{ github.event.inputs.version }}
run: |
OLD_BASE="${{ env.OLD_VERSION }}"
[[ "$OLD_BASE" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]] && OLD_BASE="${BASH_REMATCH[1]}"
IFS='.' read -r old_major old_minor old_patch <<< "$OLD_BASE"
if [ -z "$NEW_VERSION" ]; then
NEW_VERSION="${old_major}.${old_minor}.$((old_patch + 1))"
echo "No version provided, auto patch bump: $OLD_BASE → $NEW_VERSION"
else
IFS='.' read -r new_major new_minor new_patch <<< "$NEW_VERSION"
if ! ([ "$new_major" -eq $((old_major + 1)) ] && [ "$new_minor" -eq 0 ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq $((old_minor + 1)) ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq "$old_minor" ] && [ "$new_patch" -eq $((old_patch + 1)) ]); then
echo "Invalid version bump: $OLD_BASE → $NEW_VERSION"
exit 1
fi
echo "New version validated: $OLD_BASE → $NEW_VERSION"
fi
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Build
run: |
mvn clean install \
-am \
-Dcompress \
--threads 2C \
--batch-mode \
--no-transfer-progress \
-Dmaven.javadoc.skip=true
- name: Deploy ${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
mvn versions:set -DnewVersion="${{ env.NEW_VERSION }}" -DgenerateBackupPoms=false
mvn deploy -DskipTests -s .mvn/settings.xml
- name: Clean SNAPSHOT versions
if: github.event_name == 'workflow_dispatch'
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
(echo "${{ env.REPOSITORY }}"; grep -oP '(?<=<module>)[^<]+' pom.xml) | while read MODULE; do
ARTIFACT="${MODULE##*/}" # Remove directory prefix
PKG="${{ env.REGISTRY }}.${ARTIFACT//\./%2E}"
echo "Cleaning $PKG..."
gh api "/orgs/${{ env.ORGANISATION }}/packages/maven/$PKG/versions" --paginate \
--jq '[.[] | select(.name | test("SNAPSHOT"))] | sort_by(.created_at) | reverse | .[3:] | .[].id' |
xargs -r -n1 -I{} gh api -X DELETE "/orgs/${{ env.ORGANISATION }}/packages/maven/$PKG/versions/{}"
done
release-node:
name: Release Node (${{ matrix.name }})
runs-on: ubuntu-latest
needs: [changes, matrix]
strategy:
matrix:
include: ${{ fromJson(needs.matrix.outputs.node_matrix) }}
steps:
- name: Check if should run
id: should_run
run: echo "run=${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'node') || (github.event_name == 'push' && fromJSON(toJSON(needs.changes.outputs))[matrix.name] == 'true') }}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
if: steps.should_run.outputs.run == 'true'
- name: Setup Node.js
if: steps.should_run.outputs.run == 'true'
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
if: steps.should_run.outputs.run == 'true'
working-directory: ${{ matrix.path }}
run: npm install
- name: Build
if: steps.should_run.outputs.run == 'true'
working-directory: ${{ matrix.path }}
run: npm run build
- name: Get Previous Version
if: steps.should_run.outputs.run == 'true'
working-directory: ${{ matrix.path }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
PKG_NAME=$(jq -r '.name' package.json)
OLD_VERSION=$(npm view "$PKG_NAME" versions 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | grep -v snapshot | sort -V | tail -1 || echo "0.0.0")
OLD_VERSION=${OLD_VERSION:-0.0.0}
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
echo "Found old version: $OLD_VERSION"
- name: Set Snapshot Version
if: steps.should_run.outputs.run == 'true' && github.event_name == 'push'
working-directory: ${{ matrix.path }}
run: npm version "${{ env.OLD_VERSION }}-snapshot.$(date +%Y%m%d%H%M%S)" --no-git-tag-version
- name: Set Release Version
if: steps.should_run.outputs.run == 'true' && github.event_name == 'workflow_dispatch'
working-directory: ${{ matrix.path }}
env:
NEW_VERSION: ${{ github.event.inputs.version }}
run: |
OLD_BASE="${{ env.OLD_VERSION }}"
[[ "$OLD_BASE" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]] && OLD_BASE="${BASH_REMATCH[1]}"
IFS='.' read -r old_major old_minor old_patch <<< "$OLD_BASE"
if [ -z "$NEW_VERSION" ]; then
NEW_VERSION="${old_major}.${old_minor}.$((old_patch + 1))"
echo "No version provided, auto patch bump: $OLD_BASE → $NEW_VERSION"
else
IFS='.' read -r new_major new_minor new_patch <<< "$NEW_VERSION"
if ! ([ "$new_major" -eq $((old_major + 1)) ] && [ "$new_minor" -eq 0 ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq $((old_minor + 1)) ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq "$old_minor" ] && [ "$new_patch" -eq $((old_patch + 1)) ]); then
echo "Invalid version bump: $OLD_BASE → $NEW_VERSION"
exit 1
fi
echo "New version validated: $OLD_BASE → $NEW_VERSION"
fi
npm version "$NEW_VERSION" --no-git-tag-version
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Publish ${{ env.NEW_VERSION }}
if: steps.should_run.outputs.run == 'true'
working-directory: ${{ matrix.path }}
run: npm publish --tag latest --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release-rust:
name: Release Rust
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'rust'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Previous Version
run: |
OLD_VERSION=$(git tag --list 'v*' | sed 's/^v//' | \
grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
OLD_VERSION=${OLD_VERSION:-0.0.0}
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
echo "Found old version: $OLD_VERSION"
- name: Set Release Version
env:
NEW_VERSION: ${{ github.event.inputs.version }}
run: |
OLD_BASE="${{ env.OLD_VERSION }}"
[[ "$OLD_BASE" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]] && OLD_BASE="${BASH_REMATCH[1]}"
IFS='.' read -r old_major old_minor old_patch <<< "$OLD_BASE"
if [ -z "$NEW_VERSION" ]; then
NEW_VERSION="${old_major}.${old_minor}.$((old_patch + 1))"
echo "No version provided, auto patch bump: $OLD_BASE → $NEW_VERSION"
else
IFS='.' read -r new_major new_minor new_patch <<< "$NEW_VERSION"
if ! ([ "$new_major" -eq $((old_major + 1)) ] && [ "$new_minor" -eq 0 ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq $((old_minor + 1)) ] && [ "$new_patch" -eq 0 ]) &&
! ([ "$new_major" -eq "$old_major" ] && [ "$new_minor" -eq "$old_minor" ] && [ "$new_patch" -eq $((old_patch + 1)) ]); then
echo "Invalid version bump: $OLD_BASE → $NEW_VERSION"
exit 1
fi
echo "New version validated: $OLD_BASE → $NEW_VERSION"
fi
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Push Tag ${{ env.NEW_VERSION }}
run: |
TAG="v${{ env.NEW_VERSION }}"
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
echo "Tag $TAG already exists — aborting."
exit 1
fi
git tag "$TAG"
git push origin "$TAG"
echo "Created and pushed $TAG"