Skip to content

Release

Release #54

Workflow file for this run

# GitHub Actions Workflow created for handling the release process based on the draft release prepared
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
name: Release
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Setup Gradle Dependencies Cache
uses: actions/[email protected]
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- uses: Project-Env/[email protected]
- run: |
echo "ORG_GRADLE_PROJECT_projectEnvCliUsername=${{ github.actor }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_projectEnvCliPassword=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_projectEnvCommonsJavaUsername=${{ github.actor }}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_projectEnvCommonsJavaPassword=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Update Release
id: release
uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Export Revision
id: revision
run: echo "revision=$(echo '${{ steps.release.outputs.tag_name }}' | cut -c2-)" >> $GITHUB_OUTPUT
- name: Export Artifact Name
id: artifact
run: |
PROPERTIES="$(gradle properties --console=plain -q)"
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
ARTIFACT="${NAME}-${{ steps.revision.outputs.revision }}.zip"
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT
- name: Render and Export Changelog
id: changelog
uses: repolevedavaj/[email protected]
with:
text: ${{ steps.release.outputs.body }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Linters and Test
run: gradle check -PpluginVersion=${{ steps.revision.outputs.revision }} -PpluginChangelogHtml='${{ steps.changelog.outputs.html }}'
- name: Build Plugin
run: gradle buildPlugin -PpluginVersion=${{ steps.revision.outputs.revision }} -PpluginChangelogHtml='${{ steps.changelog.outputs.html }}'
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./build/distributions/${{ steps.artifact.outputs.artifact }}
asset_name: ${{ steps.artifact.outputs.artifact }}
asset_content_type: application/zip
- name: Publish Plugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: gradle publishPlugin -PpluginVersion=${{ steps.revision.outputs.revision }} -PpluginChangelogHtml='${{ steps.changelog.outputs.html }}'