meta: publishing updates #12
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 | |
on: | |
push: | |
branches: | |
- main | |
- release/** | |
paths-ignore: | |
- .github/** | |
- CHANGELOG.md | |
- README.md | |
- CODEOWNERS | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref_name }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
tag: ${{ steps.version.outputs.tag }} | |
steps: | |
- name: Parse commit message | |
id: parsed | |
uses: oss-actions/pr-title-lint@v0 | |
with: | |
into: ${{ github.ref_name }} | |
title: ${{ github.event.head_commit.message }} | |
summary: false | |
- name: Calculate next version | |
id: version | |
uses: oss-actions/auto-version@v0 | |
with: | |
type: semver | |
token: ${{ github.token }} | |
refuse_major_increment: ${{ github.ref_name != 'main' }} | |
increment: ${{ steps.parsed.outputs.increment }} | |
hard: ${{ steps.parsed.outputs.hard }} | |
- name: Create tag for version | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/git/refs \ | |
-f ref='refs/tags/${{ steps.version.outputs.tag }}' \ | |
-f sha='${{ github.event.head_commit.id }}' && echo '' | |
echo "::notice title=Versioning::Created tag: ${{ steps.version.outputs.tag }} - https://github.com/${{ github.repository }}/tree/${{ steps.version.outputs.tag }}" | |
- name: Create release branch for previous version | |
env: | |
GH_TOKEN: ${{ github.token }} | |
if: steps.version.outputs.branch != 'none' | |
run: | | |
gh api \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/git/refs \ | |
-f ref='refs/heads/${{ steps.version.outputs.branch }}' \ | |
-f sha='${{ steps.version.outputs.branch_sha }}' && echo '' | |
echo "::notice title=Versioning::Created release branch for previous version: ${{ steps.version.outputs.branch }} - https://github.com/${{ github.repository }}/tree/${{ steps.version.outputs.branch }}" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Publish Gradle Plugin | |
env: | |
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | |
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | |
VERSION: ${{ steps.version.outputs.version }} | |
run: ./gradlew :publishPlugin -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET |