Skip to content

update release ci

update release ci #6

Workflow file for this run

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
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 -PlibVersion=${{ steps.vars.outputs.version }} --no-parallel
- name: Publish documentation
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
BRANCH: gh-pages
FOLDER: re.this/build/dokka
finalize:
name: Finalize
runs-on: ubuntu-latest
needs: release
steps:
- 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: |
./parse_changelog.sh ${{ needs.version.outputs.version }} > release_notes.md
shell: bash
- name: Create release
uses: taiki-e/create-gh-release-action@v1
with:
title: ${{ steps.vars.outputs.version }}
changelog: release_notes.md
branch: master
token: ${{ secrets.ACCESS_TOKEN }}