Skip to content

Commit

Permalink
Create publish-plugin.yml
Browse files Browse the repository at this point in the history
Publish the new data type plugin jar file.
  • Loading branch information
anzhao authored Sep 15, 2024
1 parent ba75e31 commit 8e69e17
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/publish-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# publish-plugin.yml

name: build and publish plugin

on:
push:
branches: [ main ]
tags:
- 'v*.*.*' # publish new version for tag which follows 'v*.*.*' format

env:
SERVICE_NAME: ecp-plugin

jobs:
verification:
runs-on: ubuntu-22.04
steps:
- name: Checkout local repository
uses: actions/checkout@v3
with:
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Run all tests
run: ./gradlew clean check --no-daemon
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/

determine_should_publish_new_version: # Publish new version for new tags
runs-on: ubuntu-22.04
outputs:
PUBLISH_NEW_VERSION: ${{ steps.determine_should_publish_new_version.outputs.PUBLISH_NEW_VERSION }}
steps:
- name: Checkout local repository
uses: actions/checkout@v3
- name: Determine should publish docker image
id: determine_should_publish_new_version
run: |
PUBLISH_NEW_VERSION=false
if [[ $(git tag --points-at HEAD) != '' ]]; then
PUBLISH_NEW_VERSION=true
fi
echo "PUBLISH_NEW_VERSION=${PUBLISH_NEW_VERSION}" >> $GITHUB_OUTPUT
publish-jar:
runs-on: ubuntu-22.04
needs: [ determine_should_publish_new_version, verification ]
if: ${{ needs.determine_should_publish_new_version.outputs.PUBLISH_NEW_VERSION == 'true' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout local repository
uses: actions/checkout@v3
with:
path: ${{ github.workspace }}/${{ env.SERVICE_NAME }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Publish jar
run: ./gradlew publish --no-daemon
working-directory: ${{ github.workspace }}/${{ env.SERVICE_NAME }}/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8e69e17

Please sign in to comment.