Skip to content

The "all" operation will fail with "first argument to all must be a v… #6

The "all" operation will fail with "first argument to all must be a v…

The "all" operation will fail with "first argument to all must be a v… #6

Workflow file for this run

name: Publish
on:
push:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Set release version
run: |
# Remove -SNAPSHOT from version
sed -i 's/\(version "[0-9.]*\)-SNAPSHOT"/\1"/' build.gradle
- name: Publish package
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
./gradlew build uploadArchives
- name: Bump version
id: bump_version
run: |
# Get current version without SNAPSHOT
CURRENT_VERSION=$(grep "version" build.gradle | sed 's/version "\(.*\)"/\1/')
# Split into parts
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
# Increment patch version
NEXT_PATCH=$((VERSION_PARTS[2] + 1))
# Create new version
NEXT_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$NEXT_PATCH-SNAPSHOT"
# Update build.gradle
sed -i "s/version \".*\"/version \"$NEXT_VERSION\"/" build.gradle
# Make the new version available to other steps
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
- name: Commit version bump
env:
NEXT_VERSION: ${{ steps.bump_version.outputs.next_version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --all
git commit -m "Prepare version $NEXT_VERSION for development [skip ci]"
git pull --rebase origin main
git push origin HEAD:main