update release ci #14
Workflow file for this run
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: Release | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
release: | |
name: Release | |
runs-on: ${{ matrix.os }} | |
outputs: | |
version: ${{ steps.vars.outputs.version }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-version: current | |
- name: Cache konan dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.konan | |
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Get version number from tag | |
id: vars | |
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Publish with Gradle | |
env: | |
release: true | |
libVersion: ${{ steps.vars.outputs.version }} | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{secrets.SONATYPE_USERNAME}} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{secrets.SONATYPE_PASSWORD}} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{secrets.GPG_KEY_CONTENT}} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{secrets.GPG_KEY_ID}} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{secrets.GPG_KEY_PWD}} | |
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-parallel | |
- name: Publish documentation | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
BRANCH: gh-pages | |
FOLDER: build/dokka | |
finalize: | |
name: Finalize | |
runs-on: ubuntu-latest | |
needs: release | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Replace version in README.md | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: '([:"])([0-9]+\.[0-9]+\.[0-9]+)\"' | |
replace: "${1}${{ steps.vars.outputs.version }}\"" | |
include: "**README.md" | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Bump library version. | |
branch: master | |
- name: Extract changelog for version | |
id: changelog | |
run: | | |
bash ./parse_changelog.sh ${{ needs.release.outputs.version }} > release_notes.md | |
- name: Create release | |
uses: taiki-e/create-gh-release-action@v1 | |
with: | |
title: ${{ needs.release.outputs.version }} | |
changelog: release_notes.md | |
branch: master | |
token: ${{ secrets.ACCESS_TOKEN }} |