Skip to content

Commit e8bcbd8

Browse files
authoredApr 13, 2020
build: Adding semantic release workflow (#689)
* build: Adding semantic release. * Using synced secrets.
1 parent 741f832 commit e8bcbd8

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed
 

‎.github/workflows/publish.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A workflow that pushes artifacts to Sonatype
16+
name: Publish build to Sonatype
17+
18+
on:
19+
push:
20+
tags:
21+
- '*'
22+
repository_dispatch:
23+
types: [publish]
24+
25+
jobs:
26+
release:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: Publish build
34+
run: |
35+
echo "Creating .gpg key"
36+
cat ${{ secrets.SYNCED_GPG_KEY_ARMOR }} > ./release.asc
37+
gpg --quiet --output ./release.gpg --dearmor ./release.asc
38+
39+
echo "Creating build"
40+
./gradlew build publish --warn --stacktrace \
41+
-PsonatypeUsername=${{ secrets.SYNCED_SONATYPE_USERNAME }} \
42+
-PsonatypePassword=${{ secrets.SYNCED_SONATYPE_PASSWORD }} \
43+
-Psigning.keyId=${{ secrets.SYNCED_GPG_KEY_ID }} \
44+
-Psigning.password=${{ secrets.SYNCED_GPG_KEY_PASSWORD }} \
45+
-Psigning.secretKeyRingFile=./release.gpg

‎.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Release
16+
on:
17+
push:
18+
branches: [ master ]
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
with:
26+
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
27+
- name: Semantic Release
28+
uses: cycjimmy/semantic-release-action@v2
29+
with:
30+
extra_plugins: |
31+
"@semantic-release/commit-analyzer"
32+
"@semantic-release/release-notes-generator"
33+
"@google/semantic-release-replace-plugin"
34+
"@semantic-release/git
35+
"@semantic-release/github
36+
env:
37+
GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}

‎.releaserc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
branches:
2+
- master
3+
plugins:
4+
- "@semantic-release/commit-analyzer"
5+
- "@semantic-release/release-notes-generator"
6+
- - "@google/semantic-release-replace-plugin"
7+
- replacements:
8+
- files:
9+
- "./gradle-mvn-push.gradle"
10+
from: "version '.*'"
11+
to: "version '${nextRelease.version}'"
12+
13+
- files:
14+
- "README.md"
15+
from: ":[0-9].[0-9].[0-9]"
16+
to: ":${nextRelease.version}"
17+
- - "@semantic-release/git"
18+
- assets:
19+
- "./gradle-mvn-push.gradle"
20+
- "*.md"
21+
- "@semantic-release/github"
22+
options:
23+
debug: true

‎release.gpg.gpg

4.88 KB
Binary file not shown.

0 commit comments

Comments
 (0)