Skip to content

Commit a3465c4

Browse files
committed
Add publish.yml
1 parent 75ae5db commit a3465c4

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

.github/workflows/publish.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Publish
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
versionName:
6+
description: 'Version Name'
7+
required: true
8+
9+
jobs:
10+
publish:
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Set up JDK 11
19+
uses: actions/setup-java@v2
20+
with:
21+
java-version: '11'
22+
distribution: 'adopt'
23+
24+
- name: Grant Permission to Execute Gradle
25+
run: chmod +x gradlew
26+
27+
- name: Build with Gradle
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
arguments: build
31+
32+
- name: Publish Library
33+
run: |
34+
echo "Publishing library🚀"
35+
./gradlew publish --no-daemon --no-parallel
36+
echo "Published✅"
37+
38+
echo "Releasing repository...🚀"
39+
./gradlew closeAndReleaseRepository
40+
echo "Released✅"
41+
env:
42+
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }}
43+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }}
44+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSWORD }}
45+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
46+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
47+
48+
- name: Create and push tag
49+
run: |
50+
git config --global user.email "shreyaspatilg@gmail.com"
51+
git config --global user.name "$GITHUB_ACTOR"
52+
53+
git tag -a $TAG -m "Release v$TAG"
54+
git push origin $TAG
55+
env:
56+
TAG: ${{ github.event.inputs.versionName }}
57+
58+
- name: Create Release on GitHub
59+
id: create_release
60+
uses: actions/create-release@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
tag_name: ${{ github.event.inputs.versionName }}
65+
release_name: MyLib ${{ github.event.inputs.versionName }}
66+
draft: true
67+
prerelease: false

autodemolib/gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ VERSION_CODE=1
66
POM_NAME=Automation Demo Library
77
POM_DESCRIPTION=Sample library
88
POM_INCEPTION_YEAR=2022
9-
POM_URL=https://github.com/PatilShreyas/android-lib-release-demo
9+
POM_URL=https://github.com/patilshreyas/library-ci
1010

1111
POM_LICENSE_NAME=The Apache Software License, Version 2.0
1212
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
1313
POM_LICENSE_DIST=repo
1414

15-
POM_SCM_URL=https://github.com/PatilShreyas/android-lib-release-demo
16-
POM_SCM_CONNECTION=scm:git:git://github.com/PatilShreyas/android-lib-release-demo.git
17-
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/PatilShreyas/android-lib-release-demo.git
15+
POM_SCM_URL=https://github.com/patilshreyas/library-ci
16+
POM_SCM_CONNECTION=scm:git:git://github.com/patilshreyas/library-ci.git
17+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/patilshreyas/library-ci.git
1818

1919
POM_DEVELOPER_ID=PatilShreyas
2020
POM_DEVELOPER_NAME=Shreyas Patil

0 commit comments

Comments
 (0)