Skip to content

Commit

Permalink
Create publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitprajapati316 authored Mar 8, 2024
1 parent c55e156 commit 5cd934c
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and Sign

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

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

- name: Get Latest Tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'

- name: Build project
run: chmod +x gradlew

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3

- name: Publish package
run: ./gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

- name: Release
run: |
curl --location --request POST 'https://api.github.com/repos/cashfree/cashfree-pg-sdk-java/releases' \
--header 'Accept: application/vnd.github+json' \
--header "Authorization: Bearer ${{ secrets.TOKEN_GITHUB }}" \
--header 'X-GitHub-Api-Version: 2022-11-28' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag_name": "${{ steps.get-latest-tag.outputs.tag }}",
"target_commitish": "main",
"name": "${{ steps.get-latest-tag.outputs.tag }}",
"body": "Release version ${{ steps.get-latest-tag.outputs.tag }}",
"draft": false,
"prerelease": false,
"generate_release_notes": false
}'

0 comments on commit 5cd934c

Please sign in to comment.