Skip to content

Commit

Permalink
build: Adding semantic release workflow (#689)
Browse files Browse the repository at this point in the history
* build: Adding semantic release.

* Using synced secrets.
  • Loading branch information
arriolac authored Apr 13, 2020
1 parent 741f832 commit e8bcbd8
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A workflow that pushes artifacts to Sonatype
name: Publish build to Sonatype

on:
push:
tags:
- '*'
repository_dispatch:
types: [publish]

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Publish build
run: |
echo "Creating .gpg key"
cat ${{ secrets.SYNCED_GPG_KEY_ARMOR }} > ./release.asc
gpg --quiet --output ./release.gpg --dearmor ./release.asc
echo "Creating build"
./gradlew build publish --warn --stacktrace \
-PsonatypeUsername=${{ secrets.SYNCED_SONATYPE_USERNAME }} \
-PsonatypePassword=${{ secrets.SYNCED_SONATYPE_PASSWORD }} \
-Psigning.keyId=${{ secrets.SYNCED_GPG_KEY_ID }} \
-Psigning.password=${{ secrets.SYNCED_GPG_KEY_PASSWORD }} \
-Psigning.secretKeyRingFile=./release.gpg
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release
on:
push:
branches: [ master ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
"@semantic-release/commit-analyzer"
"@semantic-release/release-notes-generator"
"@google/semantic-release-replace-plugin"
"@semantic-release/git
"@semantic-release/github
env:
GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }}
23 changes: 23 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
branches:
- master
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- - "@google/semantic-release-replace-plugin"
- replacements:
- files:
- "./gradle-mvn-push.gradle"
from: "version '.*'"
to: "version '${nextRelease.version}'"

- files:
- "README.md"
from: ":[0-9].[0-9].[0-9]"
to: ":${nextRelease.version}"
- - "@semantic-release/git"
- assets:
- "./gradle-mvn-push.gradle"
- "*.md"
- "@semantic-release/github"
options:
debug: true
Binary file added release.gpg.gpg
Binary file not shown.

0 comments on commit e8bcbd8

Please sign in to comment.