-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (78 loc) · 2.88 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Release
on:
push:
branches:
- main
- release/**
paths-ignore:
- 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
packages: 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 }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: ./gradlew :publish -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET