From 976a3b82e57aeaabac22d8f37e7d1bcf19ae03ef Mon Sep 17 00:00:00 2001 From: Amith Koujalgi Date: Sat, 2 Mar 2024 20:27:37 +0530 Subject: [PATCH] [testing] - Added release-assets upload GH action --- .github/workflows/maven-publish.yml | 20 +------------- .github/workflows/release-jar.yml | 42 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/release-jar.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 95141b5..e1ac127 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -12,23 +12,12 @@ on: branches: [ "main" ] workflow_dispatch: - -permissions: - contents: read - id-token: write - packages: write - jobs: build: - runs-on: ubuntu-latest - permissions: contents: write packages: write - pull-requests: write - repository-projects: write - steps: - uses: actions/checkout@v3 - name: Set up JDK 11 @@ -76,11 +65,4 @@ jobs: env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - - name: Release Assets - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: target/*.jar \ No newline at end of file + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/release-jar.yml b/.github/workflows/release-jar.yml new file mode 100644 index 0000000..c3b34c6 --- /dev/null +++ b/.github/workflows/release-jar.yml @@ -0,0 +1,42 @@ +name: Release JAR + +on: + push: + tags: + - '**' + +permissions: + contents: read + id-token: write + packages: write + +jobs: + build: + + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + repository-projects: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B clean install package --file pom.xml + + - name: Release Assets + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: startsWith(github.ref, 'refs/tags/') + with: + files: target/*.jar