Publish JetBrains Plugin #27
This file contains hidden or 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
| name: Publish JetBrains Plugin | |
| on: | |
| schedule: | |
| - cron: '0 12 */3 * *' | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'jetbrains' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v3 | |
| - name: Increment Version | |
| id: version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Access current version from gradle.properties | |
| CURRENT_VERSION=$(grep "pluginVersion=" gradle.properties | cut -d'=' -f2) | |
| # Splitting version | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | |
| NEW_PATCH=$((PATCH + 1)) | |
| NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}" | |
| # Replace original pluginVersion в gradle.properties | |
| sed -i -e "s/pluginVersion=.*/pluginVersion=${NEW_VERSION}/g" gradle.properties | |
| # Export version number | |
| echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Create .env file | |
| run: | | |
| echo "PUBLISH_TOKEN=${{ secrets.JETBRAINS_PUBLISH_TOKEN }}" > .env | |
| - name: Publish Plugin | |
| env: | |
| PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} | |
| run: | | |
| ./gradlew publishPlugin | |
| - name: Commit and push changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| add: 'gradle.properties' | |
| author_name: GitHub Actions | |
| author_email: [email protected] | |
| message: "Bump version to ${{ steps.version.outputs.version }}" | |
| tag: "v${{ steps.version.outputs.version }}" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| files: | |
| build/distributions/Crontab-${{ steps.version.outputs.version }}.zip |