|
| 1 | +name: CI (Rider Plugin) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: {} |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build & Test (Java 17) |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Free disk space for the Rider SDK |
| 16 | + run: sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc |
| 17 | + |
| 18 | + - uses: actions/checkout@v6 |
| 19 | + |
| 20 | + - uses: actions/setup-java@v5 |
| 21 | + with: |
| 22 | + distribution: temurin |
| 23 | + java-version: '17' |
| 24 | + |
| 25 | + - uses: gradle/actions/setup-gradle@v5 |
| 26 | + with: |
| 27 | + gradle-version: '8.10.2' |
| 28 | + |
| 29 | + - name: Build plugin |
| 30 | + working-directory: rider-plugin |
| 31 | + run: gradle buildPlugin --no-daemon |
| 32 | + |
| 33 | + - name: Upload plugin ZIP |
| 34 | + uses: actions/upload-artifact@v6 |
| 35 | + with: |
| 36 | + name: rider-plugin-zip |
| 37 | + path: rider-plugin/build/distributions/*.zip |
| 38 | + retention-days: 30 |
| 39 | + |
| 40 | + # Appends a new release/tag per VERSION. Do not delete prior GitHub releases when shipping a newer version. |
| 41 | + release: |
| 42 | + name: Create GitHub Release |
| 43 | + needs: build |
| 44 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release:') |
| 45 | + runs-on: ubuntu-latest |
| 46 | + permissions: |
| 47 | + contents: write |
| 48 | + steps: |
| 49 | + - name: Free disk space for the Rider SDK |
| 50 | + run: sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc |
| 51 | + |
| 52 | + - uses: actions/checkout@v6 |
| 53 | + |
| 54 | + - uses: actions/setup-java@v5 |
| 55 | + with: |
| 56 | + distribution: temurin |
| 57 | + java-version: '17' |
| 58 | + |
| 59 | + - uses: gradle/actions/setup-gradle@v5 |
| 60 | + with: |
| 61 | + gradle-version: '8.10.2' |
| 62 | + |
| 63 | + - name: Read version |
| 64 | + id: version |
| 65 | + run: | |
| 66 | + VERSION=$(cat VERSION | tr -d '[:space:]') |
| 67 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 68 | + echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" |
| 69 | +
|
| 70 | + - name: Build plugin |
| 71 | + working-directory: rider-plugin |
| 72 | + run: gradle buildPlugin -PpluginVersion=${{ steps.version.outputs.version }} --no-daemon |
| 73 | + |
| 74 | + - name: Extract release notes from CHANGELOG |
| 75 | + run: | |
| 76 | + VERSION="${{ steps.version.outputs.version }}" |
| 77 | + if [ -f CHANGELOG.md ]; then |
| 78 | + awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md > release-notes.md |
| 79 | + fi |
| 80 | + if [ ! -s release-notes.md ]; then |
| 81 | + echo "Release ${VERSION}" > release-notes.md |
| 82 | + fi |
| 83 | +
|
| 84 | + - name: Create GitHub Release |
| 85 | + uses: softprops/action-gh-release@v3 |
| 86 | + with: |
| 87 | + tag_name: ${{ steps.version.outputs.tag }} |
| 88 | + name: v${{ steps.version.outputs.version }} |
| 89 | + body_path: release-notes.md |
| 90 | + files: rider-plugin/build/distributions/*.zip |
| 91 | + draft: false |
| 92 | + prerelease: false |
| 93 | + |
| 94 | + publish-marketplace: |
| 95 | + name: Publish to JetBrains Marketplace |
| 96 | + needs: release |
| 97 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release:') && contains(github.event.head_commit.message, '[publish]') |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - name: Free disk space for the Rider SDK |
| 101 | + run: sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc |
| 102 | + |
| 103 | + - uses: actions/checkout@v6 |
| 104 | + |
| 105 | + - uses: actions/setup-java@v5 |
| 106 | + with: |
| 107 | + distribution: temurin |
| 108 | + java-version: '17' |
| 109 | + |
| 110 | + - uses: gradle/actions/setup-gradle@v5 |
| 111 | + with: |
| 112 | + gradle-version: '8.10.2' |
| 113 | + |
| 114 | + - name: Read version |
| 115 | + id: version |
| 116 | + run: echo "version=$(cat VERSION | tr -d '[:space:]')" >> "$GITHUB_OUTPUT" |
| 117 | + |
| 118 | + - name: Publish to JetBrains Marketplace |
| 119 | + working-directory: rider-plugin |
| 120 | + run: gradle publishPlugin -PpluginVersion=${{ steps.version.outputs.version }} --no-daemon |
| 121 | + env: |
| 122 | + JETBRAINS_MARKETPLACE_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }} |
| 123 | + PLUGIN_SIGNING_CERTIFICATE_CHAIN: ${{ secrets.PLUGIN_SIGNING_CERTIFICATE_CHAIN }} |
| 124 | + PLUGIN_SIGNING_KEY: ${{ secrets.PLUGIN_SIGNING_KEY }} |
| 125 | + PLUGIN_SIGNING_KEY_PASSWORD: ${{ secrets.PLUGIN_SIGNING_KEY_PASSWORD }} |
0 commit comments