style(docs): update README.md
formatting
#263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'Publish type' | |
required: true | |
type: choice | |
options: | |
- release | |
- snapshot | |
default: snapshot | |
push: | |
jobs: | |
build: | |
name: Build & Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Check & Test | |
uses: gradle/gradle-build-action@v3 | |
with: | |
distributions-cache-enabled: true | |
configuration-cache-enabled: true | |
dependencies-cache-enabled: true | |
arguments: | | |
check | |
test | |
--stacktrace | |
--scan | |
- name: Clean project | |
run: ./gradlew clean | |
publish: | |
name: Publishing | |
needs: build | |
runs-on: ubuntu-latest | |
# Only publish on main branch | |
if: github.ref == 'refs/heads/main' | |
env: | |
RELEASE: ${{ github.event.inputs.type == 'release' }} | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BOT_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- uses: gradle/actions/setup-gradle@v3 | |
- name: Publish publications | |
run: ./gradlew publish --stacktrace | |
- name: Bump project version | |
if: ${{ github.event.inputs.type == 'release' }} | |
run: | | |
# Install semver-tool | |
wget -O /usr/local/bin/semver \ | |
https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver | |
chmod +x /usr/local/bin/semver | |
# Read current version | |
CURRENT_VERSION=$(cat version.txt) | |
echo "Current version: $CURRENT_VERSION" | |
# Update README.md | |
perl -i -pe 's/val mmkvKtxVersion = "[0-9.]*"/val mmkvKtxVersion = "'"$CURRENT_VERSION"'"/' README.md | |
perl -i -pe 's/mmkv-ktx = "[0-9.]*"/mmkv-ktx = "'"$CURRENT_VERSION"'"/' README.md | |
git add README.md | |
# Bump version | |
NEXT_VERSION=$(semver bump patch $CURRENT_VERSION) | |
echo "Next version: $NEXT_VERSION" | |
echo $NEXT_VERSION > version.txt | |
# Commit version | |
git config --local user.name "Meowool Robot" | |
git config --local user.email "[email protected]" | |
git add version.txt | |
git commit -m 'chore: update version in `README.md` & prepare for next development iteration' | |
git push |