Skip to content

Commit 4caf621

Browse files
authored
Create release.yml
1 parent 4fc1ff5 commit 4caf621

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release Error Prone
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "version number for this release."
8+
required: true
9+
10+
jobs:
11+
build-maven-jars:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Setup Signing Key
17+
run: |
18+
gpg-agent --daemon --default-cache-ttl 7200
19+
echo -e "${{ secrets.GPG_SIGNING_KEY }}" | gpg --batch --import --no-tty
20+
echo "hello world" > temp.txt
21+
gpg --detach-sig --yes -v --output=/dev/null --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" temp.txt
22+
rm temp.txt
23+
gpg --list-secret-keys --keyid-format LONG
24+
25+
- name: Checkout
26+
uses: actions/[email protected]
27+
28+
- name: Set up JDK
29+
uses: actions/[email protected]
30+
with:
31+
java-version: 11
32+
distribution: 'zulu'
33+
cache: 'maven'
34+
server-id: sonatype-nexus-staging
35+
server-username: CI_DEPLOY_USERNAME
36+
server-password: CI_DEPLOY_PASSWORD
37+
38+
- name: Bump Version Number
39+
run: |
40+
mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${{ github.event.inputs.version }}"
41+
git ls-files | grep 'pom.xml$' | xargs git add
42+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
43+
git config --global user.name "${{ github.actor }}"
44+
git commit -m "Release Error Prone ${{ github.event.inputs.version }}"
45+
git tag "v${{ github.event.inputs.version }}"
46+
echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV
47+
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/error-prone.git
48+
49+
- name: Deploy to Sonatype staging
50+
env:
51+
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
52+
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
53+
run:
54+
mvn --no-transfer-progress -P release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
55+
56+
- name: Push tag
57+
run: |
58+
git push origin "v${{ github.event.inputs.version }}"
59+
60+
- name: Draft Release Entry
61+
uses: softprops/[email protected]
62+
with:
63+
draft: true
64+
name: ${{ github.event.input.version }}
65+
tag_name: "v${{ github.event.inputs.version }}"
66+
target_commitish: ${{ env.TARGET_COMMITISH }}

0 commit comments

Comments
 (0)