Skip to content

Publish New Version #21

Publish New Version

Publish New Version #21

Workflow file for this run

name: Publish New Version
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
default: "2."
jobs:
publish:
name: Publish tinylog ${{github.event.inputs.version}}
runs-on: ubuntu-20.04
steps:
- name: Configure GIT
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{github.actor}}@users.noreply.github.com"
- name: Check out tinylog repository
uses: actions/checkout@v4
- name: Set up JDK 9
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 9
- name: Store original version
run: |
echo "ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Create version ${{github.event.inputs.version}}
run: |
mvn -DnewVersion=${{github.event.inputs.version}} -DgenerateBackupPoms=false --no-transfer-progress --batch-mode versions:set
git commit -am "Release version ${{github.event.inputs.version}}"
git tag "${{github.event.inputs.version}}"
- name: Deploy version ${{github.event.inputs.version}}
uses: samuelmeuli/action-maven-publish@v1
with:
maven_profiles: release
maven_args: "--no-transfer-progress --batch-mode"
gpg_private_key: ${{secrets.OSSRH_GPG_SECRET_KEY}}
gpg_passphrase: ${{secrets.OSSRH_GPG_PASSWORD}}
nexus_username: pmw
nexus_password: ${{secrets.OSSRH_SERVER_PASSWORD}}
- name: Create P2 repository
run: |
mvn -P release --no-transfer-progress --batch-mode --non-recursive p2:site
- name: Upload P2 repository
uses: kevinpainchaud/[email protected]
with:
ftp_host: tinylog.org
ftp_username: [email protected]
ftp_password: ${{secrets.FTP_PASSWORD_TINYLOG2_P2_REPOSITORY}}
local_source_dir: "target/repository"
dist_target_dir: ${{github.event.inputs.version}}
- name: Create release draft
uses: ncipollo/release-action@v1
with:
name: "Version ${{github.event.inputs.version}}"
tag: "${{github.event.inputs.version}}"
artifacts: "target/*"
prerelease: ${{contains(github.event.inputs.version, '-')}}
draft: true
token: ${{secrets.GITHUB_TOKEN}}
- name: Store file size
run: |
FILE_PATH_API=tinylog-api/target/tinylog-api-${{github.event.inputs.version}}.jar
FILE_SIZE_API=$(stat -c%s "$FILE_PATH_API")
FILE_PATH_IMPL=tinylog-impl/target/tinylog-impl-${{github.event.inputs.version}}.jar
FILE_SIZE_IMPL=$(stat -c%s "$FILE_PATH_IMPL")
echo "FILE_SIZE=$((FILE_SIZE_API + FILE_SIZE_IMPL))" >> $GITHUB_ENV
- name: Restore original version
run: |
mvn -DnewVersion=${ORIGINAL_VERSION} -DgenerateBackupPoms=false --no-transfer-progress --batch-mode versions:set
git commit -am "Restore snapshot version ${ORIGINAL_VERSION}"
- name: Push changes to tinylog repository
run: |
git push origin
git push origin "${{github.event.inputs.version}}"