|
8 | 8 | jobs: |
9 | 9 | build: |
10 | 10 | runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
11 | 13 |
|
12 | 14 | steps: |
13 | | - - uses: actions/checkout@v3 |
| 15 | + - name: Checkout repository |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
14 | 19 |
|
15 | 20 | - name: Set up JDK 17 |
16 | | - uses: actions/setup-java@v3 |
| 21 | + uses: actions/setup-java@v4 |
17 | 22 | with: |
18 | 23 | java-version: '17' |
19 | 24 | distribution: 'temurin' |
20 | 25 |
|
21 | | - - name: Setup Gradle |
22 | | - uses: gradle/gradle-build-action@v2 |
| 26 | + - name: Cache Gradle |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: | |
| 30 | + ~/.gradle/caches |
| 31 | + ~/.gradle/wrapper |
| 32 | + ide-plugins/.gradle |
| 33 | + key: gradle-17-${{ hashFiles('ide-plugins/**/*.gradle*','ide-plugins/**/gradle-wrapper.properties') }} |
| 34 | + restore-keys: | |
| 35 | + gradle-17- |
23 | 36 | |
24 | | - - name: Build plugin |
| 37 | + - name: Setup Gradle wrapper if missing |
25 | 38 | run: | |
26 | | - cd ide-plugins |
27 | | - ./gradlew buildPlugin |
| 39 | + if [ ! -f gradlew ] || [ ! -f gradle/wrapper/gradle-wrapper.jar ]; then |
| 40 | + echo "Setting up Gradle wrapper for Gradle 9.2.0..." |
| 41 | + cd /tmp |
| 42 | + curl -L -s -o gradle-9.2.0.zip https://services.gradle.org/distributions/gradle-9.2.0-bin.zip |
| 43 | + unzip -q gradle-9.2.0.zip |
| 44 | + cd $GITHUB_WORKSPACE/ide-plugins |
| 45 | + /tmp/gradle-9.2.0/bin/gradle wrapper --gradle-version 9.2.0 |
| 46 | + chmod +x gradlew |
| 47 | + echo "Wrapper installed" |
| 48 | + fi |
| 49 | + working-directory: ide-plugins |
| 50 | + |
| 51 | + - name: Build plugin |
| 52 | + env: |
| 53 | + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g" |
| 54 | + run: ./gradlew buildPlugin --no-daemon --stacktrace |
| 55 | + working-directory: ide-plugins |
28 | 56 |
|
29 | 57 | - name: Get plugin version |
30 | 58 | id: plugin_version |
31 | 59 | run: | |
32 | | - cd ide-plugins |
33 | 60 | VERSION=$(grep "^version" build.gradle.kts | cut -d'"' -f2) |
34 | 61 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 62 | + working-directory: ide-plugins |
35 | 63 |
|
36 | 64 | - name: Upload plugin artifact |
37 | 65 | uses: actions/upload-artifact@v4 |
38 | 66 | with: |
39 | 67 | name: picocode-plugin-${{ steps.plugin_version.outputs.version }} |
40 | | - path: plugin/build/distributions/*.zip |
| 68 | + path: ide-plugins/build/distributions/*.zip |
41 | 69 |
|
42 | 70 | - name: Upload to Release |
43 | 71 | if: github.event_name == 'release' |
44 | 72 | uses: softprops/action-gh-release@v1 |
45 | 73 | with: |
46 | | - files: plugin/build/distributions/*.zip |
| 74 | + files: ide-plugins/build/distributions/*.zip |
47 | 75 | env: |
48 | 76 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments