Created
December 8, 2023 21:10
-
-
Save sergei-mikhailovskii-idf/85b733ecc96d1135519ee0109b5e328b to your computer and use it in GitHub Desktop.
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: Publish new version | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build_project: | |
runs-on: macos-latest | |
env: | |
GITHUB_USER: ${{ secrets.GITHUB_USER }} | |
GITHUB_API_KEY: ${{ secrets.GITHUB_API_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Set version | |
run: | | |
VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) | |
major=$(echo $VERSION | cut -d'.' -f1) | |
minor=$(echo $VERSION | cut -d'.' -f2) | |
fix=$(echo $VERSION | cut -d'.' -f3) | |
echo "LIBRARY_VERSION=$major.$minor.$(($fix + 1))" >> "$GITHUB_ENV" | |
- name: Build and publish | |
run: | | |
./gradlew buildAndPublish --no-daemon | |
- name: Create tag | |
uses: actions/github-script@v7.0.1 | |
with: | |
github-token: ${{ env.GITHUB_API_KEY }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ env.LIBRARY_VERSION }}', | |
sha: context.sha | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment