-
Notifications
You must be signed in to change notification settings - Fork 47
83 lines (73 loc) · 2.84 KB
/
ossrh.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
80
81
82
83
# https://github.com/line/lich/blob/master/.github/workflows/ossrh.yml
name: Deploy To OSSRH And Release With Tag
on:
workflow_dispatch:
inputs:
cond_release:
description: 'Type "release" to release artifacts to Maven Central.'
jobs:
deploy:
runs-on: ubuntu-latest
environment: deploy
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v1
with:
java-version: 11
- name: Decode Token To File
uses: timheuer/[email protected]
with:
fileName: 'verification.properties'
fileDir: './line-sdk/src/main/resources/META-INF/com/linecorp/linesdk/linesdk/'
encodedString: ${{ secrets.SDK_CONSOLE_TOKEN }}
- name: Deploy artifacts
env:
ORG_GRADLE_PROJECT_repositoryUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_repositoryPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publish --stacktrace
- name: Release to Maven Central
if: ${{ github.event.inputs.cond_release == 'release' }}
env:
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.OSSRH_PASSWORD }}
run: ./gradlew closeAndReleaseRepository --stacktrace
tag_and_release:
name: Create Tag And Release
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Retrieve Version
run: |
version_output=$(${{github.workspace}}/gradlew -q printVersionName)
# Use awk to extract the last line from the output
# 'END{print line}' prints the last stored line after processing all input lines
VERSION_NAME=$(echo "$version_output" | awk '/./{line=$0} END{print line}')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT
id: sdk_version
- name: Get Version
run: |
echo "VERSION_NAME=${{steps.sdk_version.outputs.VERSION_NAME}}"
- name: Create Tag
id: create_tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
CUSTOM_TAG: "v${{steps.sdk_version.outputs.VERSION_NAME}}"
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{steps.sdk_version.outputs.VERSION_NAME}}"
release_name: "Release ${{steps.sdk_version.outputs.VERSION_NAME}}"
draft: false
prerelease: false