Update publish-plugin.yml #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-datatype-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: list the directories | |
run: ls -la | |
- name: list all the files under ecp-datatype-directory | |
run: ls -la | |
- name: Run all tests | |
run: ./ecp-datatype-plugin/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 }} |