aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
authorPauline <git@ethanlibs.co>2024-04-27 22:35:19 -0400
committerPauline <git@ethanlibs.co>2024-04-27 22:35:19 -0400
commit0f7a8929b05fc868961aa04ca600555ac53c468d (patch)
tree0456b63822b2d3b160842c7e3acce26a5bf3cab0 /.github/workflows/build.yml
parentd95fe9ab23f4ce19ed1a17b13f995aceefd14fd8 (diff)
downloadIntelliProcessor-0f7a8929b05fc868961aa04ca600555ac53c468d.tar.gz
IntelliProcessor-0f7a8929b05fc868961aa04ca600555ac53c468d.tar.bz2
IntelliProcessor-0f7a8929b05fc868961aa04ca600555ac53c468d.zip
🐛 fix(plugin): add github actions and revert jvm bump
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml143
1 files changed, 143 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..97f8e3b
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,143 @@
+name: Build
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+
+concurrency:
+ group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
+ cancel-in-progress: true
+
+jobs:
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.properties.outputs.version }}
+ changelog: ${{ steps.properties.outputs.changelog }}
+ pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
+ steps:
+ - name: Fetch Sources
+ uses: actions/checkout@v4
+
+ - name: Gradle Wrapper Validation
+ uses: gradle/wrapper-validation-action@v2
+
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: zulu
+ java-version: 17
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+ with:
+ gradle-home-cache-cleanup: true
+
+ - name: Export Properties
+ id: properties
+ shell: bash
+ run: |
+ PROPERTIES="$(./gradlew properties --console=plain -q)"
+ VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
+ CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
+
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
+
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
+ echo "EOF" >> $GITHUB_OUTPUT
+
+ ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
+
+ - name: Build plugin
+ run: ./gradlew buildPlugin
+
+ - name: Prepare Plugin Artifact
+ id: artifact
+ shell: bash
+ run: |
+ cd ${{ github.workspace }}/build/distributions
+ FILENAME=`ls *.zip`
+ unzip "$FILENAME" -d content
+
+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.artifact.outputs.filename }}
+ path: ./build/distributions/content/*/*
+
+ verify:
+ name: Verify plugin
+ needs: [ build ]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Maximize Build Space
+ uses: jlumbroso/free-disk-space@main
+ with:
+ tool-cache: false
+ large-packages: false
+
+ - name: Fetch Sources
+ uses: actions/checkout@v4
+
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: zulu
+ java-version: 17
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+ with:
+ gradle-home-cache-cleanup: true
+
+ - name: Setup Plugin Verifier IDEs Cache
+ uses: actions/cache@v4
+ with:
+ path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
+ key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
+
+ - name: Run Plugin Verification tasks
+ run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
+
+ - name: Collect Plugin Verifier Result
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: pluginVerifier-result
+ path: ${{ github.workspace }}/build/reports/pluginVerifier
+
+ releaseDraft:
+ name: Release draft
+ if: github.event_name != 'pull_request'
+ needs: [ build, verify ]
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Fetch Sources
+ uses: actions/checkout@v4
+
+ - name: Remove Old Release Drafts
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ gh api repos/{owner}/{repo}/releases \
+ --jq '.[] | select(.draft == true) | .id' \
+ | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
+
+ - name: Create Release Draft
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ gh release create "v${{ needs.build.outputs.version }}" \
+ --draft \
+ --title "v${{ needs.build.outputs.version }}" \
+ --notes "$(cat << 'EOM'
+ ${{ needs.build.outputs.changelog }}
+ EOM
+ )"