Skip to content

v1.0.0

v1.0.0 #1

Workflow file for this run

name: Publish PaperKit to GitHub Packages
on:
release:
types:
- published
workflow_dispatch:
jobs:
ci:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
publish:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- ci
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Get version from Git tag (for release)
id: get_release_version
if: github.event_name == 'release'
run: |
VERSION=${GITHUB_REF#refs/tags/}
if [[ "$VERSION" == v* ]]; then
VERSION="${VERSION#v}"
fi
echo "Version: $VERSION"
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Set default version for workflow_dispatch
id: set_default_version
if: github.event_name == 'workflow_dispatch'
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "MANUAL_VERSION=999.0.0-SNAPSHOT-$TIMESTAMP" >> $GITHUB_OUTPUT
- name: Publish package
run: |
PUBLISH_VERSION=""
if [[ -n "${{ steps.get_release_version.outputs.RELEASE_VERSION }}" ]]; then
PUBLISH_VERSION="${{ steps.get_release_version.outputs.RELEASE_VERSION }}"
else
PUBLISH_VERSION="${{ steps.set_default_version.outputs.MANUAL_VERSION }}"
fi
echo "Publishing with version: $PUBLISH_VERSION"
./gradlew publish -Pversion="$PUBLISH_VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}