-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (60 loc) · 2.55 KB
/
publish.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
name: publish
on:
workflow_dispatch:
release:
types: [released]
env:
SIGNING_KEY_RING_FILE: "${RUNNER_TEMP}/key.gpg"
jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/[email protected]
with:
ref: ${{ github.event.release.tag_name }}
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
# Update Unreleased section with the current release note
- name: Patch Changelog
run: |
./gradlew patchChangelog --release-note="`cat << EOM
${{ github.event.release.body }}
EOM`"
# Setup aar signing
- name: Create binary keyring
env:
GPG_KEY_CONTENTS: ${{ secrets.SONATYPE_BASE64_SIGNING_KEY }}
run: |
git fetch --unshallow
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '${{ env.SIGNING_KEY_RING_FILE }}'"
# Publish aar to maven central via sonatype repository
- name: Publish to MavenCentral
run: |
./gradlew -PmavenCentralUsername=${{ secrets.OSSRH_USERNAME }} \
-PmavenCentralPassword="${{ secrets.OSSRH_PASSWORD }}" \
-Psigning.keyId=${{ secrets.SONATYPE_SIGNING_KEY_ID }} \
-Psigning.password="${{ secrets.SONATYPE_SIGNING_KEY_PASSWORD }}" \
-Psigning.secretKeyRingFile="${{ env.SIGNING_KEY_RING_FILE }}" \
publish
# Create pull request
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name }}"
BRANCH="changelog-update-$VERSION"
git config user.email "[email protected]"
git config user.name "GitHub Action"
git checkout -b $BRANCH
git commit -am "Changelog update - $VERSION"
git push --set-upstream origin $BRANCH
gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`changelog.md\` file for the \`$VERSION\` version." \
--base master \
--head $BRANCH