Skip to content

Publish

Publish #6

Workflow file for this run

name: publish
run-name: Publish
on:
workflow_dispatch:
inputs:
gradle_debug_params:
description: 'Gradle debug parameters'
default: ''
required: false
type: string
comment:
description: 'Publish description'
default: 'Push for new revision'
required: false
type: string
revision_type:
description: 'Revision type: Major/Minor/Patch'
type: choice
required: true
default: 'patch'
options:
- 'patch'
- 'minor'
- 'major'
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.publish-it.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ vars.JAVA_VERSION }}
- uses: gradle/gradle-build-action@v2
with:
gradle-version: ${{ vars.GRADLE_VERSION }}
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- uses: actions/setup-python@v3
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: Install Python tools
run: gradle installBuildTools ${{ inputs.gradle_debug_params }}
- name: Publish
id: publish-it
run: |
bumpver update "--${{ inputs.revision_type }}"
version="$(awk '/./{line=$0} END{print line}' $(find . -type f -name .version))"
echo "version=$( echo "$version" )" >> $GITHUB_OUTPUT
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
git config --global user.email "$(git log -n 1 --pretty=format:%ae)"
git config github.token "${{ secrets.GITHUB_TOKEN }}"
git commit -a -m "[@${{ github.actor }}] ${{ inputs.comment }}"
git pull --rebase -Xtheirs && git push --atomic origin HEAD
git tag -a v"$version" -m "${{ inputs.comment }}"
git push origin --tags